示例#1
0
 private void ObserveSelectEquippedWeaponIndex(Actor actor, EquippedWeaponUIController uiController)
 {
     Broker.Global.Receive <SelectEquippedWeaponIndex>()
     .TakeUntil(Broker.Global.Receive <EndControlUserInputEquippedWeaponUI>())
     .SubscribeWithState3(this, actor, uiController, (x, _this, _actor, _uiController) =>
     {
         var instanceWeapon = _actor.StatusController.Inventory.Weapons[_this.possessionWeaponIndex];
         _actor.StatusController.ChangeEquippedWeapon(x.Index, instanceWeapon);
         Broker.Global.Publish(EndControlUserInputEquippedWeaponUI.Get(_uiController));
     })
     .AddTo(this);
 }
 void IControllableUserInput.UpdateInput()
 {
     if (Input.GetButtonDown(InputName.Left))
     {
         this.SetSelectIcon(0);
     }
     if (Input.GetButtonDown(InputName.Up))
     {
         this.SetSelectIcon(1);
     }
     if (Input.GetButtonDown(InputName.Right))
     {
         this.SetSelectIcon(2);
     }
     if (Input.GetButtonDown(InputName.Decide))
     {
         Broker.Global.Publish(SelectEquippedWeaponIndex.Get(this.selectIndex));
     }
     if (Input.GetButtonDown(InputName.Cancel))
     {
         Broker.Global.Publish(EndControlUserInputEquippedWeaponUI.Get(this));
     }
 }