Dateien

> > CS2D > Lua Scripts > OOP Menu
DateiübersichtCS2D-ÜbersichtLua Scripts-Übersicht

Englisch OOP Menu >

3 Kommentare11 kb, 406 Downloads

alt 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 >
2× editiert, zuletzt 07.11.15 18:02:26
Zugelassen von EngiN33R

Download Download

11 kb, 406 Downloads

Kommentare

3 Kommentare
Zum Anfang Vorherige 1 Nächste Zum Anfang

Logge dich ein!

Du musst dich einloggen, um selber Kommentare verfassen zu können!Einloggen

alt

Nekomata
User Off Offline

This is awesome. Nice work. o.o
Ich mag es!

alt

WaLToR
User Off Offline

Good job .
Ich mag es!

alt

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
Ich mag es!
Zum Anfang Vorherige 1 Nächste Zum Anfang