English OOP Menu icon

3 comments
07.11.15 05:53:03 pm
like 3 like it!
11 kb, 48 Downloads
tontonEd
User
Offline Off
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 :

Code:
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 :
Code:
1
2
3
function hello()
          msg("hello Basic function")
end

A main code :
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 >
imageimageimage
edited 2×, last 07.11.15 06:02:26 pm
ok This file has been reviewed and approved by EngiN33R (03.12.15 08:17:18 pm)

Comments

3 comments
Goto Page
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in
16.11.15 06:39:20 am
like I like it!
Up
Nekomata
User
Offline Off
This is awesome. Nice work. o.o
13.11.15 05:00:29 am
like I like it!
Up
WaLToR
User
Offline Off
Good job .
07.11.15 07:01:54 pm
like I like it!
Up
VADemon
User
Offline Off
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
To the start Previous 1 Next To the start