Exemplo n.º 1
0
 public virtual void DoAction()
 {
     //All the different actions for different buttons are hard-coded here.
     //TODO: Add some standard actions like switch screen, exit, back etc. that can take parameters.
     //for now it's all hard coded, but to acheive greater separation between engine and game
     //this could be changed.
     if (ID == "BackButton")
     {
         UIScreenManager.Instance.GoToLastScreen();
     }
     else if (ID == "NotificationOkButton")
     {
         PopupNotification.instance.HideNotification();
         if (PopupNotification.instance.backToMenu)
         {
             Firecracker.interpreter.execute("menu on");
         }
     }
     else if (ID == "SwitcherLeft")
     {
         ((Switcher)parent).Decrement();
     }
     else if (ID == "SwitcherRight")
     {
         ((Switcher)parent).Increment();
     }
     else
     {
         UICallBackInfo info = new UICallBackInfo();
         info.eventType = UIEventType.ButtonAction;
         info.ID        = ID;
         IDRegistrar.ExecuteCallBack(info);
     }
 }
Exemplo n.º 2
0
        public override void Init()
        {
            //the initial values of the switcher are set here.
            //for now this is all done with code, but ideally
            //it would be possible to bind a switcher to
            //boolean or enum game options. This would require
            //an overhaul of how settings work though.

            //default index is 0.
            selectedIndex = 0;

            //find the index.

            //if there aren't enough elements to allow switching, disable the buttons.
            ((Label)InnerElements[2]).SetText(this.options[selectedIndex]);

            if (options.Count < 2)
            {
                ((Button)InnerElements[0]).disabled = true;
                ((Button)InnerElements[1]).disabled = true;
            }
            else
            {
                ((Button)InnerElements[0]).disabled = false;
                ((Button)InnerElements[1]).disabled = false;
            }

            UICallBackInfo info = new UICallBackInfo();

            info.ID        = ID;
            info.eventType = UIEventType.SwitcherInit;
            IDRegistrar.ExecuteCallBack(info);
            base.Init();
        }
Exemplo n.º 3
0
        public void DoAction()
        {
            //actions are hard-coded for now.
            //it would be better if sliders could simply be bound to a game setting with max/min values.
            UICallBackInfo info = new UICallBackInfo();

            info.ID          = ID;
            info.eventType   = UIEventType.SliderChangeValue;
            info.sliderValue = value;
            IDRegistrar.ExecuteCallBack(info);
        }
Exemplo n.º 4
0
        public void DoAction()
        {
            //actions are hard-coded. again, if the switchers could
            //be bound to a game setting this wouldn't be needed.
            UICallBackInfo info = new UICallBackInfo();

            info.ID            = ID;
            info.eventType     = UIEventType.SwitcherChangeValue;
            info.switcherIndex = selectedIndex;
            IDRegistrar.ExecuteCallBack(info);
        }
Exemplo n.º 5
0
        public override void Init()
        {
            //initialization of the value of the slider is currently hard-coded.
            //ideally it could be bound to a game setting with min/max values but this would
            //require an overhauld of the settings system.


            //find the value


            //put the handle in the right spot based on the value found.
            InnerElements[1].pos.X = (value - 0.5f) * InnerElements[0].size.X;
            base.Init();

            UICallBackInfo info = new UICallBackInfo();

            info.ID        = ID;
            info.eventType = UIEventType.SliderInit;
            IDRegistrar.ExecuteCallBack(info);
        }