コード例 #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);
     }
 }
コード例 #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();
        }
コード例 #3
0
ファイル: Slider.cs プロジェクト: nitro404/Angry_Angry_Island
        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);
        }
コード例 #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);
        }
コード例 #5
0
ファイル: Slider.cs プロジェクト: nitro404/Angry_Angry_Island
        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);
        }