コード例 #1
0
 public override void Update()
 {
     if (this.open)
     {
         if (this._showWarning)
         {
             this._selectionChanged = true;
             if (Input.Pressed("QUACK"))
             {
                 SFX.Play("consoleCancel");
                 this._showWarning = false;
             }
             else if (Input.Pressed("GRAB"))
             {
                 SFX.Play("death");
                 this._showedWarning = true;
                 this._showWarning   = false;
                 if (Level.core.gameInProgress)
                 {
                     Main.ResetGameStuff();
                     Main.ResetMatchStuff();
                     Level.core.gameInProgress = false;
                     Send.Message((NetMessage) new NMResetGameSettings());
                 }
             }
         }
         else
         {
             int slot = this._slot;
             if (Input.Pressed("LEFT") && (this._slot == 1 || this._slot == 3))
             {
                 --this._slot;
             }
             if (Input.Pressed("RIGHT") && (this._slot == 0 || this._slot == 2))
             {
                 ++this._slot;
             }
             if (Input.Pressed("UP") && (this._slot == 2 || this._slot == 3))
             {
                 this._slot -= 2;
             }
             if (Input.Pressed("DOWN") && (this._slot == 0 || this._slot == 1))
             {
                 this._slot += 2;
             }
             UISlotEditor.hoveringSlot = this._slot;
             if (this._slot != slot)
             {
                 this._selectionChanged = true;
             }
             if (this._slot == 0)
             {
                 this._rectPosition = new Vec2(0.0f, 0.0f);
             }
             else if (this._slot == 1)
             {
                 this._rectPosition = new Vec2(178f, 0.0f);
             }
             else if (this._slot == 2)
             {
                 this._rectPosition = new Vec2(0.0f, 90f);
             }
             else if (this._slot == 3)
             {
                 this._rectPosition = new Vec2(178f, 90f);
             }
             if (this._selectionChanged)
             {
                 if (DuckNetwork.profiles[this._slot].connection != null && DuckNetwork.profiles[this._slot].connection != DuckNetwork.localConnection)
                 {
                     HUD.CloseCorner(HUDCorner.TopLeft);
                     HUD.AddCornerControl(HUDCorner.TopLeft, "@GRAB@KICK");
                 }
                 else
                 {
                     HUD.CloseCorner(HUDCorner.TopLeft);
                 }
                 if (DuckNetwork.profiles[this._slot].connection != DuckNetwork.localConnection)
                 {
                     HUD.CloseCorner(HUDCorner.BottomLeft);
                     HUD.AddCornerControl(HUDCorner.BottomLeft, "TOGGLE MODE@SELECT@");
                 }
                 else
                 {
                     HUD.CloseCorner(HUDCorner.BottomLeft);
                 }
                 this._selectionChanged = false;
             }
             if (Input.Pressed("SELECT") && DuckNetwork.profiles[this._slot].connection != DuckNetwork.localConnection)
             {
                 if (!this._showedWarning && Level.core.gameInProgress)
                 {
                     this._showWarning = true;
                     SFX.Play("pause");
                     HUD.CloseAllCorners();
                     HUD.AddCornerControl(HUDCorner.BottomLeft, "YEAH OK!@GRAB@");
                     HUD.AddCornerControl(HUDCorner.BottomRight, "@QUACK@CANCEL");
                 }
                 else
                 {
                     int num = (int)(DuckNetwork.profiles[this._slot].slotType + 1);
                     if (DuckNetwork.profiles[this._slot].reservedUser != null && num == 5)
                     {
                         ++num;
                     }
                     if (DuckNetwork.profiles[this._slot].reservedUser == null && num >= 5 || DuckNetwork.profiles[this._slot].reservedUser != null && num > 6)
                     {
                         num = 0;
                     }
                     DuckNetwork.profiles[this._slot].slotType = (SlotType)num;
                     DuckNetwork.ChangeSlotSettings();
                     SFX.Play("menuBlip01");
                 }
             }
             else if (Input.Pressed("GRAB") && DuckNetwork.profiles[this._slot].connection != DuckNetwork.localConnection)
             {
                 DuckNetwork.Kick(DuckNetwork.profiles[this._slot]);
             }
             else if (Input.Pressed("QUACK"))
             {
                 SFX.Play("consoleCancel");
                 new UIMenuActionOpenMenu((UIComponent)this, (UIComponent)this._closeMenu).Activate();
             }
         }
     }
     base.Update();
 }