public void ClearButton() { this.assignedUnitDataObject = null; SetUnitType(Unit.UnitType.UNIT_NONE); SetLevel(0); closeButtonImage.SetActive(false); }
public void SetUnitDataObject(UnitDataObject unitDataObject) { InitializeIfNeeded(); this.assignedUnitDataObject = unitDataObject; SetUnitType(this.assignedUnitDataObject.unitType); SetLevel(this.assignedUnitDataObject.level); closeButtonImage.SetActive(true); }
void SelectedUnitButton_Tapped(GameObject unitSelectionTabButton) { UnitSelectionTabButton unitSelectionTabButtonScript = unitSelectionTabButton.GetComponent <UnitSelectionTabButton> (); selectedUnitDataObject = unitSelectionTabButtonScript.assignedUnitDataObject; CancelUpgrades(); SwitchDetailToTab(UnitDetailSubpanelType.UNITDETAILSUBPANEL_TYPE_CHARACTER); }
public void SetUnitDataObject(UnitDataObject unitDataObject) { InitializeIfNeeded(); this.assignedUnitDataObject = unitDataObject; SetUnitType(this.assignedUnitDataObject.unitType); SetLevel(this.assignedUnitDataObject.level); UpdateDisplay(); }
public void UnassignUnit() { if (this.assignedUnitDataObject != null) { this.assignedUnitDataObject.assignedTeam = 0; this.assignedUnitDataObject = null; } SetUnitType(Unit.UnitType.UNIT_NONE); SetLevel(0); }
public void UnassignUnit() { if (this.assignedUnitDataObject != null) { this.assignedUnitDataObject.assignedTeam = 0; this.assignedUnitDataObject = null; } SetUnitType(Unit.UnitType.UNIT_NONE); SetLevel(0); closeButtonImage.SetActive(false); }
public void EquipToUnit(UnitDataObject unit) { InitializeIfNeeded(); this.equippedByUnit = unit; if (this.type == InventoryItemType.INVENTORY_ITEM_TYPE_ARMOR) { unit.equippedArmor = (Armor)this; } else if (this.type == InventoryItemType.INVENTORY_ITEM_TYPE_WEAPON) { unit.equippedWeapon = (Weapon)this; } this.state = InventoryItemState.INVENTORY_ITEM_STATE_EQUIPPED; this.level = 1; this.UpdateStats(); }
void InitializeIfNeeded() { if (this.tcScript == null) { Camera mainCamera = Camera.main; this.tcScript = mainCamera.GetComponent <TacticalCombat> (); } if (selectedUnitDataObject == null) { selectedUnitDataObject = this.tcScript.unitDataObjectsList [0]; } if (unitDetailSubpanel == null) { unitDetailSubpanel = transform.Find("UnitDetailSubpanel").gameObject; characterTab = unitDetailSubpanel.transform.Find("CharacterTab").gameObject; weaponTab = unitDetailSubpanel.transform.Find("WeaponTab").gameObject; armorTab = unitDetailSubpanel.transform.Find("ArmorTab").gameObject; characterUpgradingText = characterTab.transform.Find("CharacterUpgradingText").gameObject; characterLevelValueText = characterTab.transform.Find("CharacterLevelValueText").gameObject; characterLevelLabelText = characterTab.transform.Find("CharacterLevelLabelText").gameObject; unitProfilePicBZ = characterTab.transform.Find("UnitProfilePicBZ").gameObject; unitProfilePicFT = characterTab.transform.Find("UnitProfilePicFT").gameObject; unitProfilePicGL = characterTab.transform.Find("UnitProfilePicGL").gameObject; unitProfilePicGR = characterTab.transform.Find("UnitProfilePicGR").gameObject; unitProfilePicMG = characterTab.transform.Find("UnitProfilePicMG").gameObject; weaponUpgradingText = weaponTab.transform.Find("WeaponUpgradingText").gameObject; weaponLevelValueText = weaponTab.transform.Find("WeaponLevelValueText").gameObject; weaponLevelLabelText = weaponTab.transform.Find("WeaponLevelLabelText").gameObject; weaponIcon = weaponTab.transform.Find("WeaponIcon").gameObject; armorUpgradingText = armorTab.transform.Find("ArmorUpgradingText").gameObject; armorLevelValueText = armorTab.transform.Find("ArmorLevelValueText").gameObject; armorLevelLabelText = armorTab.transform.Find("ArmorLevelLabelText").gameObject; armorIcon = armorTab.transform.Find("ArmorIcon").gameObject; statValuesText = unitDetailSubpanel.transform.Find("StatValuesText").gameObject; statLabelsText = unitDetailSubpanel.transform.Find("StatLabelsText").gameObject; statButton1 = unitDetailSubpanel.transform.Find("StatButton1").gameObject; statButton2 = unitDetailSubpanel.transform.Find("StatButton2").gameObject; statButton3 = unitDetailSubpanel.transform.Find("StatButton3").gameObject; characterTabButton = unitDetailSubpanel.transform.Find("CharacterTabButton").gameObject; weaponTabButton = unitDetailSubpanel.transform.Find("WeaponTabButton").gameObject; armorTabButton = unitDetailSubpanel.transform.Find("ArmorTabButton").gameObject; upgradeButton = unitDetailSubpanel.transform.Find("UpgradeButton").gameObject; addToTeamButton = unitDetailSubpanel.transform.Find("AddToTeamButton").gameObject; } if (unitSelectionScrollViewContent == null) { unitSelectionScrollViewContent = GameObject.Find("UnitSelectionScrollViewContent"); } if (!isInitialized && unitSelectionScrollViewContent != null) { isInitialized = true; this.unitSelectionTabButtonList = new List <GameObject> (); // Create buttons for each unit for (int i = 0; i < tcScript.unitDataObjectsList.Count; i++) { UnitDataObject unitDataObject = tcScript.unitDataObjectsList [i]; GameObject unitSelectionTabButton = (GameObject)Instantiate(this.unitSelectionTabButtonPrefab, Vector3.zero, Quaternion.identity); unitSelectionTabButton.transform.parent = unitSelectionScrollViewContent.transform; RectTransform rectTransform = unitSelectionTabButton.GetComponent <RectTransform> (); rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, -400, 1320.0f /* * 0.25f*/); rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, -150 - 18 + 120 * i * 0.75f, 432.0f /* * 0.25f*/); unitSelectionTabButton.transform.localScale = new Vector3(0.2f, 0.2f, 0.2f); UnitSelectionTabButton unitSelectionTabButtonScript = unitSelectionTabButton.GetComponent <UnitSelectionTabButton> (); unitSelectionTabButtonScript.SetUnitDataObject(unitDataObject); Button tappableButtonScript = unitSelectionTabButton.GetComponent <Button> (); tappableButtonScript.onClick.AddListener(delegate { SelectedUnitButton_Tapped(unitSelectionTabButton); }); this.unitSelectionTabButtonList.Add(unitSelectionTabButton); } // Set scrollview content size based on number of units RectTransform contentViewRectTransform = unitSelectionScrollViewContent.GetComponent <RectTransform> (); contentViewRectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Left, 0, 1320.0f /* * 0.25f*/); contentViewRectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Top, 0, 120.0f * tcScript.unitDataObjectsList.Count * 0.75f * 1.01f); } }
public void ClearButton() { this.assignedUnitDataObject = null; SetUnitType(Unit.UnitType.UNIT_NONE); SetLevel(0); }