public FFXEditor(bool fileMode = false) { InitializeComponent(); if (fileMode) { // Set up window for file mode } else { // Set up window for process mode GameMemory.ProcessExited += Close; _generalPanel = new GeneralPanel(); _partyPanel = new PartyPanel(); _aeonsPanel = new AeonsPanel(); _itemsPanel = new ItemsPanel(); _sphereGridPanel = new SphereGridPanel(); _equipmentPanel = new EquipmentPanel(); _blitzballPanel = new BlitzballPanel(); _monsterArenaPanel = new MonsterArenaPanel(); _debugPanel = new DebugPanel(); _battlePanel = new BattlePanel(); _boostersPanel = new BoostersPanel(); } // Set up general window parameters _skillEditorPanel = new SkillEditorPanel(); (EditorTree.Items[0] as TreeViewItem).IsSelected = true; }
void SetPartyPanelPosition(PartyPanel partyPanel, RectTransform newPosition) { // get current position RectTransform currentPosition = partyPanel.GetComponent <RectTransform>(); // set position has been changed flag positionHasBeenChanged = true; // Change to the new position SetRectTransform(newPosition, currentPosition); }
/// <summary> /// Sets references to components that will display information about a partyMember /// </summary> public void SetExternalDisplayComponents() { eventDescription = EventManager.instance.eventDescription; actionsPanel = EventManager.instance.actionsPanel; partyPanel = EventManager.instance.partyPanel; gearPanel = EventManager.instance.gearPanel; candlesPanel = EventManager.instance.candlesPanel; statusPanel = EventManager.instance.statusPanel; skillsPanel = EventManager.instance.skillsPanel; utilityTabManager = EventManager.instance.utilityTabManager; }
/*************************************************************** * Populates the initial display with the existing players **************************************************************/ private void generatePlayerPanels() { foreach (Player player in Game.players) { if (player.id > -1) { PartyPanel currentPlayer = PartyPanel.create(player); currentPlayer.transform.SetParent(party_vertical_layout.transform); partyPanels.Add(currentPlayer); } } }
public void DismissGenericUnit(UnitSlot unitSlot) { // get PartyUnit UI PartyUnitUI unitUI = unitSlot.GetComponentInChildren <PartyUnitUI>(); // get PartyUnit PartyUnit partyUnit = unitUI.LPartyUnit; // Get Unit size, because unit is going to be destroyed UnitSize unitSize = partyUnit.UnitSize; // Get Party Unit HeroParty //HeroParty heroParty = partyUnit.GetComponentInParent<HeroParty>(); // 1 get all required variables, before removing unit Transform unitCell = unitSlot.transform.parent; PartyPanel partyPanel = GetUnitsParentPartyPanel(unitCell); // 2 and put it to recycle bin, because otherwise PartyPanel.GetNumberOfPresentUnits() will return wrong number of units, because object is actually destroyed after Update() // unitUI.transform.SetParent(transform.root.GetComponentInChildren<RecycleBin>().transform); // 3 destory unit canvas, where it is linked to // Destroy(unitUI.gameObject); // 4 and put it to recycle bin, because otherwise city.GetNumberOfPresentUnits() will return wrong number of units, because object is actually destroyed after Update() // partyUnit.transform.SetParent(transform.root.GetComponentInChildren<RecycleBin>().transform); // 5 and destory party unit itself // Destroy(partyUnit.gameObject); RecycleBin.Recycle(unitUI.gameObject); RecycleBin.Recycle(partyUnit.gameObject); // Update party panel // act based on the unit size if (unitSize == UnitSize.Single) { partyPanel.OnChange(PartyPanel.ChangeType.DismissSingleUnit, unitCell); } else { partyPanel.OnChange(PartyPanel.ChangeType.DismissDoubleUnit, unitCell); } // if parent Party panel is in Garnizon state, then update focus panel if (PartyMode.Garnizon == partyPanel.PartyMode) { // Instruct focus panel linked to a city to update information // act based on the unit size if (unitSize == UnitSize.Single) { GetComponentInParent <UIManager>().GetFocusPanelByCity(LCity).OnChange(FocusPanel.ChangeType.DismissSingleUnit); } else { GetComponentInParent <UIManager>().GetFocusPanelByCity(LCity).OnChange(FocusPanel.ChangeType.DismissDoubleUnit); } // Activate hire unit buttons again SetHireUnitPnlButtonActive(true); } }
public void DestroyParty(PartyPanel partyPanel) { Debug.Log("Destroy party"); // set variables HeroParty heroParty = partyPanel.GetHeroParty(); MapHero heroOnMapRepresentation = heroParty.LMapHero; MapObjectLabel heroOnMapLabel = heroOnMapRepresentation.GetComponent <MapObject>().Label; // destroy label Destroy(heroOnMapLabel.gameObject); // destroy on map party representation Destroy(heroOnMapRepresentation.gameObject); // destroy party Destroy(heroParty.gameObject); }
void LinkPartyUnitToUI(PartyUnit partyUnit) { // Get PartyPanel PartyPanel partyPanel = GetComponentInChildren <PartyPanel>(true); // Get unit slot Transform by unit address Transform unitSlotTransform = partyPanel.transform.Find(partyUnit.UnitPPRow + "/" + partyUnit.UnitPPCell).GetComponentInChildren <UnitSlot>(true).transform; // Get unit canvas template GameObject unitCanvasTemplate = transform.root.Find("Templates/UI/UnitCanvas").gameObject; // Create new unit canvas in unit slot PartyUnitUI newUnitCanvas = Instantiate(unitCanvasTemplate, unitSlotTransform).GetComponent <PartyUnitUI>(); // link party Unit to canvas newUnitCanvas.LPartyUnit = partyUnit; // enable new unit canvas newUnitCanvas.gameObject.SetActive(true); }
void EnterBattleCommon(HeroParty playerHeroParty, HeroParty enemyHeroParty) { // activate this battle sreen gameObject.SetActive(true); // get Left Hero Party UI HeroPartyUI playerHeroPartyUI = transform.root.Find("MiscUI/LeftHeroParty").GetComponent <HeroPartyUI>(); // link Player to the Left UI playerHeroPartyUI.LHeroParty = playerHeroParty; // get Right Hero Party UI HeroPartyUI enemyHeroPartyUI = transform.root.Find("MiscUI/RightHeroParty").GetComponent <HeroPartyUI>(); // link Enemy to the Right UI enemyHeroPartyUI.LHeroParty = enemyHeroParty; // Record original poisitions playerHeroParty.PreBattleParentTr = playerHeroParty.transform.parent; enemyHeroParty.PreBattleParentTr = enemyHeroParty.transform.parent; // set if party can escape based on its original position playerHeroParty.CanEscapeFromBattle = CanEscape(playerHeroParty.PreBattleParentTr); enemyHeroParty.CanEscapeFromBattle = CanEscape(enemyHeroParty.PreBattleParentTr); // Activate Hero parties UIs upfront so that PartyLeaders UIs are created playerHeroPartyUI.gameObject.SetActive(true); enemyHeroPartyUI.gameObject.SetActive(true); // init left focus panel InitFocusPanel("LeftFocus", playerHeroPartyUI); // init right focus panel InitFocusPanel("RightFocus", enemyHeroPartyUI); //// assign party leader to the left focus panel //transform.root.Find("MiscUI/LeftFocus").GetComponent<FocusPanel>().focusedObject = playerHeroPartyUI.GetPartyLeaderUI().gameObject; //// assign party leader to the right focus panel //transform.root.Find("MiscUI/RightFocus").GetComponent<FocusPanel>().focusedObject = enemyHeroPartyUI.GetPartyLeaderUI().gameObject; // trigger battle screen enable event battleScreenEnable.Raise(); // Activate all needed UI at once SetCommonBattleUIActive(true); // Get parties panels playerPartyPanel = playerHeroPartyUI.GetComponentInChildren <PartyPanel>(); enemyPartyPanel = enemyHeroPartyUI.GetComponentInChildren <PartyPanel>(); // Set if parties panels are AI or player controllable // .. do it automatically in future, based on ... playerPartyPanel.IsAIControlled = false; enemyPartyPanel.IsAIControlled = false; // start turn based battle StartBattle(); }
bool VerifyDoubleUnitHire(Transform callerCell, PartyUnit selectedUnit) { bool result = false; PartyPanel partyPanel = transform.GetComponentInParent <UIManager>().GetHeroPartyUIByMode(PartyMode.Garnizon, false).GetComponentInChildren <PartyPanel>(true); // if all checks passed, then verify result is success // verify that we do not get more units, then city can keep bool cityCapacityOverflowCheckIsOK = partyPanel.VerifyCityCapacityOverflowOnDoubleUnitHire(); // verify if player is highring double unit near occupied single unit cell // this is not possible and will cause double unit to be displayed on top of single unit // we should avoid this bool doubleUnintIsNotHiredNearOccupiedSingleCell = partyPanel.VerifyDoubleHireNearOccupiedSingleCell(callerCell); // if all conditions are met, then set result to true; if (cityCapacityOverflowCheckIsOK && doubleUnintIsNotHiredNearOccupiedSingleCell) { result = true; } return(result); }
public void ActivateAdvance(MapHero mapHero) { Debug.Log("Show Party Info"); //// clone hero panel and place it into the middle placeholder //SetPartyPanelPosition(mapHero.LHeroParty.Find("PartyPanel"), transform.Find("SinglePartyPlaceholder")); // Get Lefto Hero Party UI HeroPartyUI leftHeroPartyUI = transform.root.Find("MiscUI/LeftHeroParty").GetComponent <HeroPartyUI>(); // assign HeroParty to left hero party UI leftHeroPartyUI.LHeroParty = mapHero.LHeroParty; // Get Party Panel PartyPanel partyPanel = leftHeroPartyUI.GetComponentInChildren <PartyPanel>(true); // Get new position RectTransform newPosition = transform.Find("SinglePartyPlaceholder").GetComponent <RectTransform>(); // Change Party Panel position to new SetPartyPanelPosition(partyPanel, newPosition); // activate left hero party UI leftHeroPartyUI.gameObject.SetActive(true); // deactivate inventory leftHeroPartyUI.GetComponentInChildren <PartyInventoryUI>(true).gameObject.SetActive(false); //// Activate placeholder to be used as background //transform.Find("SinglePartyPlaceholder").gameObject.SetActive(true); }
void OnDisable() { // deactivate all child panels (placeholders) foreach (Transform childTransform in transform) { childTransform.gameObject.SetActive(false); } // Deactivate what was activated // Deactivate left hero party UI transform.root.Find("MiscUI/LeftHeroParty").gameObject.SetActive(false); // Deactivate right hero party UI transform.root.Find("MiscUI/RightHeroParty").gameObject.SetActive(false); // Get Party Panel PartyPanel partyPanel = transform.root.Find("MiscUI/LeftHeroParty").GetComponent <HeroPartyUI>().GetComponentInChildren <PartyPanel>(true); // verify if party panel position has changed if (positionHasBeenChanged) { // Change PartyPanel Position back to original SetPartyPanelPosition(partyPanel, transform.Find("LeftPartyInfoPlaceHolder").GetComponent <RectTransform>()); // Reset flag to false positionHasBeenChanged = false; } }