/* ============================================================================ Call functions ============================================================================ */ public void CallMenu(BattleMenuMode m, BattleMenuItem bmi) { this.lastUpdate = Time.time; this.callMode = m; this.mode = m; this.Init(bmi); }
public void Back() { DataHolder.BattleSystem().TargetSelectionOff(); this.blinkSet = -1; if(this.lastBMItem == null || this.lastBMItem.type == BattleMenu.ATTACK || !this.lastBMItem.isTarget) { this.mode = BattleMenuMode.BASE; this.list = DataHolder.BattleMenu().BattleMenuList(this.owner); this.bmPosition = DataHolder.BattleMenu().dialoguePosition; this.UpdateChoices(true); this.lastBMItem = null; } else if(this.lastBMItem.type == BattleMenu.SKILL && this.lastBMItem.isTarget) { this.mode = BattleMenuMode.SKILL; this.list = DataHolder.BattleMenu().GetSkillMenuList(DataHolder.Skill(this.lastBMItem.id).skilltype, this.owner); this.bmPosition = DataHolder.BattleMenu().skillPosition; this.UpdateChoices(true); this.lastBMItem = new BattleMenuItem(new GUIContent(""), -1, BattleMenu.SKILL, false, ""); } else if(this.lastBMItem.type == BattleMenu.ITEM && this.lastBMItem.isTarget) { this.mode = BattleMenuMode.ITEM; this.list = DataHolder.BattleMenu().GetItemMenuList(DataHolder.Item(this.lastBMItem.id).itemType, this.owner); this.bmPosition = DataHolder.BattleMenu().itemPosition; this.UpdateChoices(true); this.lastBMItem = new BattleMenuItem(new GUIContent(""), -1, BattleMenu.ITEM, false, ""); } }
public void Clear() { this.mode = BattleMenuMode.BASE; this.list = new BattleMenuItem[0]; this.choices = new ChoiceContent[0]; this.blinkSet = -1; this.lastBMItem = null; }
/* ============================================================================ Interaction functions ============================================================================ */ public void Select(int index) { BattleMenuItem prevItem = this.lastBMItem; this.lastBMItem = this.list[this.realID[index]]; if(this.lastBMItem.isTarget) { if((this.lastBMItem.type == BattleMenu.ATTACK && this.owner.IsBlockAttack()) || (this.lastBMItem.type == BattleMenu.SKILL && this.owner.IsBlockSkills()) || (this.lastBMItem.type == BattleMenu.ITEM && this.owner.IsBlockItems())) { this.lastBMItem = null; } else if(this.lastBMItem.action == null) { if(this.lastBMItem.type == BattleMenu.SKILL && !DataHolder.Skill(this.lastBMItem.id).CanUse(this.owner, this.lastBMItem.useLevel)) { this.mode = BattleMenuMode.SKILL; this.list = DataHolder.BattleMenu().GetSkillMenuList(DataHolder.Skill(this.lastBMItem.id).skilltype, this.owner); this.bmPosition = DataHolder.BattleMenu().skillPosition; this.UpdateChoices(true); this.lastBMItem = new BattleMenuItem(new GUIContent(""), -1, BattleMenu.SKILL, false, ""); } else { BattleMenuItem[] newList = DataHolder.BattleMenu().GetTargetMenuList(this.lastBMItem, this.owner); if((DataHolder.BattleMenu().addBack && newList.Length > 1) || (!DataHolder.BattleMenu().addBack && newList.Length > 0)) { this.mode = BattleMenuMode.TARGET; this.list = newList; this.bmPosition = DataHolder.BattleMenu().targetPosition; this.UpdateChoices(true); } else { this.lastBMItem = prevItem; GameHandler.GetLevelHandler().SetLastBMIndex(); } } } else { BattleAction action = this.lastBMItem.action; action.BlinkTargets(false); if(action.targetRaycast.NeedInteraction()) { this.rayTarget = true; this.rayAction = action; this.mode = BattleMenuMode.TARGET; this.list = new BattleMenuItem[0]; this.UpdateChoices(true); this.hide = true; } else { if(action.targetRaycast.active) { action.rayTargetSet = true; action.rayPoint = action.targetRaycast.GetRayPoint(this.owner.prefabInstance, VectorHelper.GetScreenCenter()); } this.owner.EndBattleMenu(false); this.owner.AddAction(action); } } } else { if(this.lastBMItem.type == BattleMenu.SKILL) { if(this.owner.IsBlockSkills()) { this.lastBMItem = null; } else { this.mode = BattleMenuMode.SKILL; this.list = DataHolder.BattleMenu().GetSkillMenuList(this.lastBMItem.id, this.owner); this.bmPosition = DataHolder.BattleMenu().skillPosition; this.UpdateChoices(true); } } else if(this.lastBMItem.type == BattleMenu.ITEM) { if(this.owner.IsBlockItems()) { this.lastBMItem = null; } else { this.mode = BattleMenuMode.ITEM; this.list = DataHolder.BattleMenu().GetItemMenuList(this.lastBMItem.id, this.owner); this.bmPosition = DataHolder.BattleMenu().itemPosition; this.UpdateChoices(true); } } else if(this.lastBMItem.type == BattleMenu.DEFEND) { if(this.owner.IsBlockDefend()) { this.lastBMItem = null; } else { this.owner.EndBattleMenu(false); this.owner.AddAction(new BattleAction(AttackSelection.DEFEND, this.owner, this.owner.battleID, -1, 0)); } } else if(this.lastBMItem.type == BattleMenu.ESCAPE) { if(this.owner.IsBlockEscape() || !DataHolder.BattleSystem().canEscape) { this.lastBMItem = null; } else { this.owner.EndBattleMenu(false); this.owner.AddAction(new BattleAction(AttackSelection.ESCAPE, this.owner, this.owner.battleID, -1, 0)); } } else if(this.lastBMItem.type == BattleMenu.ENDTURN) { this.owner.EndTurn(); } else if(this.lastBMItem.type == BattleMenu.BACK) { this.lastBMItem = prevItem; GameHandler.GetLevelHandler().BattleMenuBack(true); } } }
/* ============================================================================ Battle menu functions ============================================================================ */ public void ShowBattleMenu(BattleMenuMode mode, BattleMenuItem bmi) { if(DataHolder.BattleSystem().IsRealTime()) { if(DataHolder.BattleSystem().blockControlMenu) GameHandler.SetBlockControl(1); if(DataHolder.BattleSystem().freezeAction) GameHandler.FreezeTime(true); } this.battleMenu.SetOwner(this); this.battleMenu.CallMenu(mode, bmi); this.isChoosingAction = true; GameHandler.GetLevelHandler().AddBattleMenuUser(this); }
public bool IsCalledMenuMode(BattleMenuMode mode) { bool same = false; if(this.isChoosingAction && this.battleMenu.callMode.Equals(mode)) { same = true; } return same; }