Example #1
0
    void ClickObject(GuiClickRect rect, int btn)
    {
        GuiClickable component = rect.GetComponent <GuiClickable>();

        if (component != null)
        {
            for (int i = this.currClickers.Count - 1; i >= 0; i--)
            {
                if (this.currClickers[i].click == component)
                {
                    return;
                }
            }
            this.currClickers.Add(new EntityHUD.ClickTrack(component, btn));
            component.SendClick();
            if (component as GuiClickableWheel)
            {
                this.MouseMove(btn, this.mouseTag.Pos);
            }
        }
        else
        {
            Debug.LogWarning("No function bound to clicker");
        }
    }
Example #2
0
 void SetupButtons()
 {
     if (this.buttons == null)
     {
         EntityHUDData.Button[] array = this._data.GetButtons();
         this.buttons         = new List <EntityHUD.Button>(array.Length);
         this.buttonListeners = new List <MappedInput.ButtonEventListener>(array.Length);
         for (int i = 0; i < array.Length; i++)
         {
             EntityHUDData.Button button = array[i];
             EntityHUD.Button     nBtn   = new EntityHUD.Button(button);
             this.buttons.Add(nBtn);
             if (nBtn.button != null)
             {
                 this.ownedObjects.Add(nBtn.button.gameObject);
                 GuiClickable componentInChildren = nBtn.button.gameObject.GetComponentInChildren <GuiClickable>();
                 if (componentInChildren != null)
                 {
                     GuiClickableWheel guiClickableWheel = componentInChildren as GuiClickableWheel;
                     if (guiClickableWheel != null)
                     {
                         guiClickableWheel.onclick = delegate(object b)
                         {
                             this.PressedWheel();
                         };
                         guiClickableWheel.ondir = delegate(Vector2 d)
                         {
                             this.UpdateWheel(d);
                         };
                         guiClickableWheel.onrelease = delegate(object b)
                         {
                             this.ReleasedWheel();
                         };
                     }
                     else
                     {
                         componentInChildren.onclick = delegate(object b)
                         {
                             this.PressedButton(nBtn, null);
                         };
                     }
                 }
             }
             if (button.hotkey != null)
             {
                 this.buttonListeners.Add(this._input.RegisterButtonDown(button.hotkey, delegate(InputButton b)
                 {
                     this.PressedButton(nBtn, null);
                 }, -1));
             }
         }
     }
     if (this.mouseTag == null && PlatformInfo.Current.AllowMouseInput)
     {
         this.mouseTag = PrioMouseHandler.GetHandler(this._input).GetListener(2, new PrioMouseHandler.MouseDownFunc(this.MouseDown), new PrioMouseHandler.MouseMoveFunc(this.MouseMove), new PrioMouseHandler.MouseUpFunc(this.MouseUp));
     }
 }
Example #3
0
 void SetupVariables(Entity ent)
 {
     if (this.counters == null)
     {
         this.counters = new Dictionary <string, ICounterOverlay>();
         EntityHUDData.VarConnection[] varConnects = this._data.GetVarConnects();
         for (int i = 0; i < varConnects.Length; i++)
         {
             string         varName      = varConnects[i].varName;
             CounterOverlay pooledWindow = OverlayWindow.GetPooledWindow <CounterOverlay>(varConnects[i].hudPrefab);
             pooledWindow.SetValue(ent.GetStateVariable(varName));
             this.counters.Add(varName, pooledWindow);
             this.ownedObjects.Add(pooledWindow.gameObject);
         }
         EntityHUDData.WeaponConnection[] weaponConnects = this._data.GetWeaponConnects();
         for (int j = 0; j < weaponConnects.Length; j++)
         {
             string            varName2      = weaponConnects[j].varName;
             WeaponIconOverlay pooledWindow2 = OverlayWindow.GetPooledWindow <WeaponIconOverlay>(weaponConnects[j].hudPrefab);
             pooledWindow2.SetValue(ent.GetStateVariable(varName2));
             this.counters.Add(varName2, pooledWindow2);
             if (this.controller != null)
             {
                 InputButton key;
                 if (this.controller.GetKeyForAction(weaponConnects[j].actionName, out key))
                 {
                     pooledWindow2.SetKey(key);
                     GuiClickable componentInChildren = pooledWindow2.GetComponentInChildren <GuiClickable>();
                     if (componentInChildren != null)
                     {
                         componentInChildren.onclick = delegate(object b)
                         {
                             this.controller.SignalPress(key);
                         };
                         componentInChildren.onrelease = delegate(object b)
                         {
                             this.controller.SignalRelease(key);
                         };
                     }
                 }
             }
             this.ownedObjects.Add(pooledWindow2.gameObject);
         }
     }
     else
     {
         foreach (KeyValuePair <string, ICounterOverlay> keyValuePair in this.counters)
         {
             keyValuePair.Value.SetValue(ent.GetStateVariable(keyValuePair.Key));
         }
     }
 }
Example #4
0
 public ClickTrack(GuiClickable click, int btn)
 {
     this.click = click;
     this.btn   = btn;
 }