Files

> > CS2D > Lua Scripts > OOP Menu
Files overviewCS2D overviewLua Scripts overview

English OOP Menu >

3 comments11 kb, 428 Downloads

old OOP Menu

tontonEd
User Off Offline

hi, I share my implementation of my "OOP" menu, that I've made for
the pcs mixmatch script. http://github.com/edwinmrtn/pcs_mixmatch

there is an automatic pagination system when more than 6 buttons are added to a menu.
Each button will execute a function and/or a method on press

MenuList(int id)
     
Spoiler >


Menu(int id,string title)
Spoiler >


Button(int Id,String Nom,String Value,String Fonction,Object Object,String FoncObject,String ParamOb)
     
Spoiler >


let's have a class cat like that :

1
2
3
4
5
6
7
8
9
10
11
12
13
Cat = newclass("Cat")
--Constructor
		function Cat:init(Id)
			self.Id      = Id 
		end
--methods
		function Cat:getId()
			return self.Id
		end
		function Cat:speak(param)
			msg("miewwww")
			msg(param)
		end
A Random function :
1
2
3
function hello()
		msg("hello Basic function")
end
A main code :
1
2
3
4
5
6
7
8
9
10
11
12
--new menuList -  only use this instance for all menu
		theMenuList    = MenuList(0);
--new menu
		local amenu = Menu(1,"Title")
		theMenuList:addMenu(amenu);
--new cat 
		local aCat = Cat(1)
--new Bouton  
		local abutton  = button(1,"name","value","hello",aCat,":speak","randomString")
				  
		amenu:addButton(abutton)
		amenu:Show(id)
Results on screens below
Server.lua :
Spoiler >



Licences :
Spoiler >
edited 2×, last 07.11.15 06:02:26 pm
Approved by EngiN33R

Download Download

11 kb, 428 Downloads

Comments

3 comments
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in

old

Nekomata
User Off Offline

This is awesome. Nice work. o.o
I like it!

old

WaLToR
User Off Offline

Good job .
I like it!

old

VADemon
User Off Offline

A direct alternative to Unimenu 2

But you really need to reread your code and remove all the "french touch" %)

PS: The title is not descriptive enough
I like it!
To the start Previous 1 Next To the start