Exemplo n.º 1
0
 public override void ModeChangeEvent(object sender, Enum e)
 {
     if (!e.Equals(_battleMode))
     {
         base.ModeChangeEvent(sender, e);
         _battleMode = (Damageable.BattleMode)e;
         if (!e.Equals(Damageable.BattleMode.EndTurn)) //because endturn triggers BattleMenu refresh.
         {
             Refresh();
         }
     }
 }
Exemplo n.º 2
0
        public override void Refresh()
        {
            if (Damageable == null)
            {
                return;
            }
            if (Memory.State?.Characters != null && Damageable.GetCharacterData(out _))
            {
                var party = GetParty();
                if (GetCharPos(party) == 0xFF)
                {
                    return;
                }
            }

            var pos       = PartyPos;
            var rectangle = SIZE[0];

            rectangle.Offset(0f, SIZE[0].Height * pos);
            var atbBarPos = new Rectangle(rectangle.X + 230, rectangle.Y + 12, ATBWidth, 15);

            ((ATB)ITEM[0, (int)DepthID.ATBCharging]).Pos     = atbBarPos;
            ((Texture)ITEM[0, (byte)DepthID.ATBCharged]).Pos = atbBarPos;
            ((Icon)ITEM[0, (byte)DepthID.ATBBorder]).Pos     = atbBarPos;
            ((GF)ITEM[0, (byte)DepthID.GFCharging]).Pos      = atbBarPos;
            ((Text)ITEM[0, (byte)DepthID.Name]).Data         = Damageable.Name;
            ((Text)ITEM[0, (byte)DepthID.Name]).Pos          = new Rectangle(rectangle.X - 60, rectangle.Y, 0, 0);
            ((Integer)ITEM[0, (byte)DepthID.HP]).Pos         = new Rectangle(rectangle.X + 128, rectangle.Y, 0, 0);

            ((Text)ITEM[0, (byte)DepthID.Name]).Draw(true);
            ((Integer)ITEM[0, (byte)DepthID.HP]).Draw(true);

            ((Box)ITEM[0, (byte)DepthID.GFHPBox]).Pos = Rectangle.Union(
                ((Text)ITEM[0, (byte)DepthID.Name]).DataSize,
                ((Integer)ITEM[0, (byte)DepthID.HP]).DataSize);
            ((Box)ITEM[0, (byte)DepthID.GFHPBox]).Y       -= 4;
            ((Box)ITEM[0, (byte)DepthID.GFNameBox]).Y      = ((Box)ITEM[0, (byte)DepthID.GFHPBox]).Y;
            ((Box)ITEM[0, (byte)DepthID.GFNameBox]).Height = ((Box)ITEM[0, (byte)DepthID.GFHPBox]).Height = rectangle.Height;
            ((Box)ITEM[0, (byte)DepthID.GFNameBox]).X      =
                ((Box)ITEM[0, (byte)DepthID.GFHPBox]).X -
                (((Box)ITEM[0, (byte)DepthID.GFHPBox]).Width * 3) / 8;
            ((Box)ITEM[0, (byte)DepthID.GFNameBox]).Width = (((Box)ITEM[0, (byte)DepthID.GFHPBox]).Width * 7) / 8;
            if (Damageable.SummonedGF != null)
            {
                ((Box)ITEM[0, (byte)DepthID.GFNameBox]).Data = Damageable.SummonedGF.Name;
                ((Box)ITEM[0, (byte)DepthID.GFHPBox]).Data   = $"{Damageable.SummonedGF.CurrentHP()}";
            }
            if (_eventAdded == false)
            {
                _eventAdded = true;
                Damageable.BattleModeChangeEventHandler += ModeChangeEvent;
            }
            var blink    = false;
            var charging = false;

            _battleMode = (Damageable.BattleMode)Damageable.GetBattleMode();

            ITEM[0, (byte)DepthID.HP].Show();
            ITEM[0, (byte)DepthID.Name].Show();
            ITEM[0, (byte)DepthID.GFNameBox].Hide();
            ITEM[0, (byte)DepthID.GFHPBox].Hide();

            ITEM[0, (int)DepthID.ATBCharged].Hide();
            ITEM[0, (int)DepthID.GFCharging].Hide();
            ITEM[0, (int)DepthID.ATBCharging].Hide();
            switch (_battleMode)
            {
            case Damageable.BattleMode.YourTurn:
                ((Texture)ITEM[0, (int)DepthID.ATBCharged]).Color = Color.LightYellow * ATBAlpha;
                blink = true;
                break;

            case Damageable.BattleMode.ATB_Charged:
                ((Texture)ITEM[0, (int)DepthID.ATBCharged]).Color = Color.Yellow * ATBAlpha;
                break;

            case Damageable.BattleMode.ATB_Charging:
                charging = true;
                ((ATB)ITEM[0, (int)DepthID.ATBCharging]).Refresh(Damageable);
                ITEM[0, (int)DepthID.ATBCharging].Show();
                break;

            case Damageable.BattleMode.GF_Charging:
                charging = true;
                ITEM[0, (byte)DepthID.HP].Hide();
                ITEM[0, (byte)DepthID.Name].Hide();
                ITEM[0, (byte)DepthID.GFNameBox].Show();
                ITEM[0, (byte)DepthID.GFHPBox].Show();
                ITEM[0, (int)DepthID.GFCharging].Show();
                ITEM[0, (int)DepthID.GFCharging].Refresh(Damageable.SummonedGF);
                break;

            case Damageable.BattleMode.EndTurn:
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            if (!charging)
            {
                ITEM[0, (int)DepthID.ATBCharged].Show();
            }
            ((Texture)ITEM[0, (int)DepthID.ATBCharged]).Blink = blink;
            ((Text)ITEM[0, (byte)DepthID.Name]).Blink         = blink;
            ((Integer)ITEM[0, (byte)DepthID.HP]).Blink        = blink;

            base.Refresh();
        }
Exemplo n.º 3
0
        public override void Refresh()
        {
            if (Damageable != null)
            {
                if (Memory.State?.Characters != null && Damageable.GetCharacterData(out Saves.CharacterData c))
                {
                    List <KeyValuePair <int, Characters> > party = GetParty();
                    if (GetCharPos(party) == 0xFF)
                    {
                        return;
                    }
                }
                else
                {
                }
                sbyte     pos       = PartyPos;
                Rectangle rectangle = SIZE[0];
                rectangle.Offset(0f, SIZE[0].Height * pos);
                Rectangle atbbarpos = new Rectangle(rectangle.X + 230, rectangle.Y + 12, ATBWidth, 15);
                ((IGMDataItem.Gradient.ATB)ITEM[0, (int)DepthID.ATBCharging]).Pos = atbbarpos;
                ((IGMDataItem.Texture)ITEM[0, (byte)DepthID.ATBCharged]).Pos      = atbbarpos;
                ((IGMDataItem.Icon)ITEM[0, (byte)DepthID.ATBBorder]).Pos          = atbbarpos;
                ((IGMDataItem.Gradient.GF)ITEM[0, (byte)DepthID.GFCharging]).Pos  = atbbarpos;
                ((IGMDataItem.Text)ITEM[0, (byte)DepthID.Name]).Data = Damageable.Name;
                ((IGMDataItem.Text)ITEM[0, (byte)DepthID.Name]).Pos  = new Rectangle(rectangle.X - 60, rectangle.Y, 0, 0);
                ((IGMDataItem.Integer)ITEM[0, (byte)DepthID.HP]).Pos = new Rectangle(rectangle.X + 128, rectangle.Y, 0, 0);

                ((IGMDataItem.Text)ITEM[0, (byte)DepthID.Name]).Draw(true);
                ((IGMDataItem.Integer)ITEM[0, (byte)DepthID.HP]).Draw(true);

                ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFHPBox]).Pos = Rectangle.Union(
                    ((IGMDataItem.Text)ITEM[0, (byte)DepthID.Name]).DataSize,
                    ((IGMDataItem.Integer)ITEM[0, (byte)DepthID.HP]).DataSize);
                ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFHPBox]).Y       -= 4;
                ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFNameBox]).Y      = ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFHPBox]).Y;
                ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFNameBox]).Height = ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFHPBox]).Height = rectangle.Height;
                ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFNameBox]).X      =
                    ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFHPBox]).X -
                    (((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFHPBox]).Width * 3) / 8;
                ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFNameBox]).Width = (((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFHPBox]).Width * 7) / 8;
                if (Damageable.SummonedGF != null)
                {
                    ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFNameBox]).Data = Damageable.SummonedGF.Name;
                    ((IGMDataItem.Box)ITEM[0, (byte)DepthID.GFHPBox]).Data   = $"{Damageable.SummonedGF.CurrentHP()}";
                }
                if (EventAdded == false)
                {
                    EventAdded = true;
                    Damageable.BattleModeChangeEventHandler += ModeChangeEvent;
                }
                bool blink    = false;
                bool charging = false;
                BattleMode = (Damageable.BattleMode)Damageable.GetBattleMode();

                ITEM[0, (byte)DepthID.HP].Show();
                ITEM[0, (byte)DepthID.Name].Show();
                ITEM[0, (byte)DepthID.GFNameBox].Hide();
                ITEM[0, (byte)DepthID.GFHPBox].Hide();

                ITEM[0, (int)DepthID.ATBCharged].Hide();
                ITEM[0, (int)DepthID.GFCharging].Hide();
                ITEM[0, (int)DepthID.ATBCharging].Hide();
                if (BattleMode.Equals(Damageable.BattleMode.YourTurn))
                {
                    ((IGMDataItem.Texture)ITEM[0, (int)DepthID.ATBCharged]).Color = Color.LightYellow * ATBalpha;
                    blink = true;
                }
                else if (BattleMode.Equals(Damageable.BattleMode.ATB_Charged))
                {
                    ((IGMDataItem.Texture)ITEM[0, (int)DepthID.ATBCharged]).Color = Color.Yellow * ATBalpha;
                }
                else if (BattleMode.Equals(Damageable.BattleMode.ATB_Charging))
                {
                    charging = true;
                    ((IGMDataItem.Gradient.ATB)ITEM[0, (int)DepthID.ATBCharging]).Refresh(Damageable);
                    ITEM[0, (int)DepthID.ATBCharging].Show();
                }
                else if (BattleMode.Equals(Damageable.BattleMode.GF_Charging))
                {
                    charging = true;
                    ITEM[0, (byte)DepthID.HP].Hide();
                    ITEM[0, (byte)DepthID.Name].Hide();
                    ITEM[0, (byte)DepthID.GFNameBox].Show();
                    ITEM[0, (byte)DepthID.GFHPBox].Show();
                    ITEM[0, (int)DepthID.GFCharging].Show();
                    ITEM[0, (int)DepthID.GFCharging].Refresh(Damageable.SummonedGF);
                }
                if (!charging)
                {
                    ITEM[0, (int)DepthID.ATBCharged].Show();
                }
                ((IGMDataItem.Texture)ITEM[0, (int)DepthID.ATBCharged]).Blink = blink;
                ((IGMDataItem.Text)ITEM[0, (byte)DepthID.Name]).Blink         = blink;
                ((IGMDataItem.Integer)ITEM[0, (byte)DepthID.HP]).Blink        = blink;

                base.Refresh();
            }
        }