示例#1
0
 /// <summary>
 /// Frame Update (when target window is active)
 /// </summary>
 void UpdateTarget()
 {
     // If B button was pressed
     if (Input.RMTrigger.B)
     {
         // Play cancel SE
         InGame.System.SoundPlay(Data.System.CancelSoundEffect);
         // If unable to use because items ran out
         if (!InGame.Party.IsItemCanUse(item.Id))
         {
             // Remake item window contents
             itemWindow.Refresh();
         }
         // Erase target window
         itemWindow.IsActive    = true;
         targetWindow.IsVisible = false;
         targetWindow.IsActive  = false;
         return;
     }
     // If C button was pressed
     if (Input.RMTrigger.C)
     {
         // If items are used up
         if (InGame.Party.ItemNumber(item.Id) == 0)
         {
             // Play buzzer SE
             InGame.System.SoundPlay(Data.System.BuzzerSoundEffect);
             return;
         }
         bool _used = false;
         // If target is all
         if (targetWindow.Index == -1)
         {
             // Apply item effects to entire party
             foreach (GameActor actor in InGame.Party.Actors)
             {
                 _used |= actor.ItemEffect(item);
             }
         }
         // If single target
         if (targetWindow.Index >= 0)
         {
             // Apply item use effects to target actor
             GameActor target = InGame.Party.Actors[targetWindow.Index];
             _used = target.ItemEffect(item);
         }
         // If an item was used
         if (_used)
         {
             // Play item use SE
             InGame.System.SoundPlay(item.MenuSoundEffect);
             // If consumable
             if (item.Consumable)
             {
                 // Decrease used items by 1
                 InGame.Party.LoseItem(item.Id, 1);
                 // Redraw item window item
                 itemWindow.DrawItem(itemWindow.Index);
             }
             // Remake target window contents
             targetWindow.Refresh();
             // If all party members are dead
             if (InGame.Party.IsAllDead)
             {
                 // Switch to game over screen
                 Main.Scene = new SceneGameover();
                 return;
             }
             // If common event ID is valid
             if (item.CommonEventId > 0)
             {
                 // Common event call reservation
                 InGame.Temp.CommonEventId = item.CommonEventId;
                 // Switch to map screen
                 Main.Scene = new SceneMap();
                 return;
             }
         }
         // If item wasn't used
         if (!_used)
         {
             // Play buzzer SE
             InGame.System.SoundPlay(Data.System.BuzzerSoundEffect);
         }
         return;
     }
 }
示例#2
0
 /// <summary>
 /// Frame Update (if skill window is active)
 /// </summary>
 void UpdateSkill()
 {
     // If B button was pressed
     if (Input.RMTrigger.B)
     {
         // Play cancel SE
         InGame.System.SoundPlay(Data.System.CancelSoundEffect);
         // Switch to menu screen
         Main.Scene = new SceneMenu(1);
         return;
     }
     // If C button was pressed
     if (Input.RMTrigger.C)
     {
         // Get currently selected data on the skill window
         skill = skillWindow.Skill;
         // If unable to use
         if (skill == null || !actor.IsSkillCanUse(skill.Id))
         {
             // Play buzzer SE
             InGame.System.SoundPlay(Data.System.BuzzerSoundEffect);
             return;
         }
         // Play decision SE
         InGame.System.SoundPlay(Data.System.DecisionSoundEffect);
         // If effect scope is ally
         if (skill.Scope >= 3)
         {
             // Activate target window
             skillWindow.IsActive   = false;
             targetWindow.X         = (skillWindow.Index + 1) % 2 * 304;
             targetWindow.IsVisible = true;
             targetWindow.IsActive  = true;
             // Set cursor position to effect scope (single / all)
             if (skill.Scope == 4 || skill.Scope == 6)
             {
                 targetWindow.Index = -1;
             }
             else if (skill.Scope == 7)
             {
                 targetWindow.Index = actorIndex - 10;
             }
             else
             {
                 targetWindow.Index = 0;
             }
         }
         // If effect scope is other than ally
         else
         {
             // If common event ID is valid
             if (skill.CommonEventId > 0)
             {
                 // Common event call reservation
                 InGame.Temp.CommonEventId = skill.CommonEventId;
                 // Play use skill SE
                 InGame.System.SoundPlay(skill.MenuSoundEffect);
                 // Use up SP
                 actor.Sp -= skill.SpCost;
                 // Remake each window content
                 statusWindow.Refresh();
                 skillWindow.Refresh();
                 targetWindow.Refresh();
                 // Switch to map screen
                 Main.Scene = new SceneMap();
                 return;
             }
         }
         return;
     }
     // If R button was pressed
     if (Input.RMTrigger.R)
     {
         // Play cursor SE
         InGame.System.SoundPlay(Data.System.CursorSoundEffect);
         // To next actor
         actorIndex += 1;
         actorIndex %= InGame.Party.Actors.Count;
         // Switch to different skill screen
         Main.Scene = new SceneSkill(actorIndex);
         return;
     }
     // If L button was pressed
     if (Input.RMTrigger.L)
     {
         // Play cursor SE
         InGame.System.SoundPlay(Data.System.CursorSoundEffect);
         // To previous actor
         actorIndex += InGame.Party.Actors.Count - 1;
         actorIndex %= InGame.Party.Actors.Count;
         // Switch to different skill screen
         Main.Scene = new SceneSkill(actorIndex);
         return;
     }
 }