Ejemplo n.º 1
0
 public override Boolean OnKeyMenu(GameObject go)
 {
     if (base.OnKeyMenu(go) && !_hidingHud && ButtonGroupState.ActiveGroup == CommandGroupButton)
     {
         if (ReadyQueue.Count > 1)
         {
             Int32 num = ReadyQueue[0];
             ReadyQueue.RemoveAt(0);
             ReadyQueue.Add(num);
             using (List <Int32> .Enumerator enumerator = ReadyQueue.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     Int32 current = enumerator.Current;
                     if (!InputFinishList.Contains(current) && !_unconsciousStateList.Contains(current) && current != CurrentPlayerIndex)
                     {
                         if (ReadyQueue.IndexOf(current) > 0)
                         {
                             ReadyQueue.Remove(current);
                             ReadyQueue.Insert(0, current);
                         }
                         SwitchPlayer(current);
                         break;
                     }
                 }
             }
         }
         else if (ReadyQueue.Count == 1)
         {
             SwitchPlayer(ReadyQueue[0]);
         }
     }
     return(true);
 }
Ejemplo n.º 2
0
    public void RemovePlayerFromAction(Int32 btlId, Boolean isNeedToClearCommand)
    {
        Int32 num = 0;

        while (1 << num != btlId)
        {
            ++num;
        }

        if (InputFinishList.Contains(num) && isNeedToClearCommand)
        {
            InputFinishList.Remove(num);
        }

        if (!ReadyQueue.Contains(num) || !isNeedToClearCommand)
        {
            return;
        }

        ReadyQueue.Remove(num);
    }
Ejemplo n.º 3
0
    private void UpdatePlayer()
    {
        _blinkAlphaCounter += RealTime.deltaTime * 3f;
        _blinkAlphaCounter  = _blinkAlphaCounter <= 2.0 ? _blinkAlphaCounter : 0.0f;
        Single alpha = _blinkAlphaCounter > 1.0 ? 2f - _blinkAlphaCounter : _blinkAlphaCounter;

        if (!_commandEnable)
        {
            return;
        }

        foreach (UI.PanelParty.Character character in _partyDetail.Characters.Entries)
        {
            if (character.PlayerId == -1)
            {
                continue;
            }

            BattleUnit player = FF9StateSystem.Battle.FF9Battle.GetUnit(character.PlayerId);
            if ((player.IsUnderStatus(BattleStatus.Confuse) || player.IsUnderStatus(BattleStatus.Berserk)) && character.ATBBlink)
            {
                character.ATBBlink = false;
            }
            if (IsEnableInput(player) && !_isAutoAttack)
            {
                if (character.ATBBlink)
                {
                    character.ATBBar.Foreground.Widget.alpha = alpha;
                }

                if (character.TranceBlink && player.HasTrance)
                {
                    character.TranceBar.Foreground.Widget.alpha = alpha;
                }
            }
            else
            {
                if (character.ATBBlink)
                {
                    character.ATBBar.Foreground.Widget.alpha           = 1f;
                    character.ATBBar.Foreground.Highlight.Sprite.alpha = 0.0f;
                }
                if (character.TranceBlink && player.HasTrance)
                {
                    character.TranceBar.Foreground.Widget.alpha           = 1f;
                    character.TranceBar.Foreground.Highlight.Sprite.alpha = 0.0f;
                }
            }
        }

        YMenu_ManagerHpMp();
        CheckPlayerState();
        DisplayPartyRealtime();

        if (TargetPanel.activeSelf)
        {
            DisplayTarget();
            _statusPanel.DisplayStatusRealtime(_matchBattleIdPlayerList);
        }

        ManagerTarget();
        ManagerInfo();

        if (CurrentPlayerIndex > -1)
        {
            BattleUnit unit = FF9StateSystem.Battle.FF9Battle.GetUnit(CurrentPlayerIndex);
            if (ButtonGroupState.ActiveGroup == CommandGroupButton && _isTranceMenu)
            {
                _tranceColorCounter = (_tranceColorCounter + 1) % TranceTextColor.Length;
                _commandPanel.SetCaptionColor(TranceTextColor[_tranceColorCounter]);
            }

            if (!IsEnableInput(unit))
            {
                SetIdle();
                return;
            }

            if (TargetPanel.activeSelf)
            {
                if (!ManageTargetCommand())
                {
                    return;
                }
            }
            else if (AbilityPanel.activeSelf || ItemPanel.activeSelf)
            {
                if (AbilityPanel.activeSelf)
                {
                    DisplayAbilityRealTime();
                }

                if (ItemPanel.activeSelf)
                {
                    DisplayItemRealTime();
                }

                if ((Int32)_currentCommandId == 31 && (!_magicSwordCond.IsViviExist || _magicSwordCond.IsViviDead || _magicSwordCond.IsSteinerMini))
                {
                    FF9Sfx.FF9SFX_Play(101);
                    ResetToReady();
                    return;
                }

                if (!_isTranceMenu && unit.IsUnderAnyStatus(BattleStatus.Trance))
                {
                    FF9Sfx.FF9SFX_Play(101);
                    ResetToReady();
                    return;
                }
            }
        }

        if (ReadyQueue.Count <= 0 || CurrentPlayerIndex != -1)
        {
            return;
        }

        for (Int32 index = ReadyQueue.Count - 1; index >= 0; --index)
        {
            if (!_unconsciousStateList.Contains(ReadyQueue[index]))
            {
                continue;
            }

            BattleUnit unit = FF9StateSystem.Battle.FF9Battle.GetUnit(ReadyQueue[index]);
            Boolean    needToClearCommand = unit.IsUnderStatus(BattleStatus.CmdCancel);
            RemovePlayerFromAction(unit.Id, needToClearCommand);
        }

        using (List <Int32> .Enumerator enumerator = ReadyQueue.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                Int32 current = enumerator.Current;
                if (InputFinishList.Contains(current) || _unconsciousStateList.Contains(current))
                {
                    continue;
                }

                if (_isAutoAttack)
                {
                    SendAutoAttackCommand(current);
                    break;
                }

                SwitchPlayer(current);
                break;
            }
        }
    }