// Version for Archetypes attached to heroes private ArchetypeUITreeNode CreateTreeNode(ArchetypeSkillNode node, HashSet <ArchetypeSkillNode> traversedNodes, HeroArchetypeData archetype, UILineRenderer parent, Dictionary <ArchetypeSkillNode, ArchetypeUITreeNode> nodeDict) { if (node == null) { return(null); } ArchetypeUITreeNode currentNode; // Check if node has been traversed yet // if already created, just return the node if (traversedNodes.Add(node)) { currentNode = Instantiate(nodePrefab, parent.transform); currentNode.SetNode(node, archetype, false); nodeDict.Add(node, currentNode); if (Math.Abs(node.nodePosition.x) > largestX) { largestX = Math.Abs(node.nodePosition.x); } if (Math.Abs(node.nodePosition.y) > largestY) { largestY = Math.Abs(node.nodePosition.y); } } else { return(nodeDict[node]); } int currentNodeLevel = archetype.GetNodeLevel(node); foreach (int x in node.children) { ArchetypeSkillNode n = archetype.Base.GetNode(x); ArchetypeUITreeNode child = CreateTreeNode(n, traversedNodes, archetype, parent, nodeDict); Color color = Color.black; int childNodeLevel = archetype.GetNodeLevel(n); if (currentNodeLevel > 0 && childNodeLevel > 0) { color = ArchetypeUITreeNode.CONNECTED_COLOR; } else if (currentNodeLevel > 0 || childNodeLevel > 0) { color = ArchetypeUITreeNode.AVAILABLE_COLOR; } UILineRenderer.LinePoint point = new UILineRenderer.LinePoint(currentNode.transform.localPosition + LineOffsetY, child.transform.localPosition + LineOffsetY, color); currentNode.connectedNodes.Add(child, point); child.connectedNodes.Add(currentNode, point); parent.AddPoints(point); } return(currentNode); }
public void UpdatePanel() { int currentLevel = archetypeData.GetNodeLevel(node); if (uiNode.isLevelable && !archetypeData.IsNodeMaxLevel(node) && hero.ArchetypePoints > 0) { levelButton.interactable = true; } else { levelButton.interactable = false; } if (archetypeData.GetNodeLevel(node) > 0 && node.initialLevel == 0 && IsChildrenIndependent()) { delevelButton.interactable = true; } else { delevelButton.interactable = false; } infoText.text = ""; nextInfoText.text = ""; topApText.text = "AP: " + hero.ArchetypePoints; nextInfoText.gameObject.SetActive(false); if (node.type == NodeType.ABILITY) { string[] strings = LocalizationManager.Instance.GetLocalizationText_Ability(node.abilityId); infoText.text += "<b>" + strings[0] + " Lv" + hero.GetAbilityLevel() + "</b>\n"; infoText.text += LocalizationManager.Instance.GetLocalizationText_AbilityBaseDamage(hero.GetAbilityLevel(), node.GetAbility()); infoText.text += node.GetAbility().GetAbilityBonusTexts(hero.GetAbilityLevel()); infoText.text += strings[1]; } else { if (currentLevel == 0) { infoText.text += "<b>Level 1: </b>\n"; infoText.text += node.GetBonusInfoString(1); if (node.maxLevel > 1) { nextInfoText.gameObject.SetActive(true); nextInfoText.text += "<b>Level " + (node.maxLevel) + ":</b>\n"; nextInfoText.text += node.GetBonusInfoString(node.maxLevel); } return; } if (currentLevel != 0) { infoText.text += "<b>Current: Level " + currentLevel + "</b>\n"; infoText.text += node.GetBonusInfoString(currentLevel); } if (currentLevel != node.maxLevel) { nextInfoText.gameObject.SetActive(true); nextInfoText.text += "<b>Next: Level " + (currentLevel + 1) + "</b>\n"; nextInfoText.text += node.GetBonusInfoString(currentLevel + 1); } } }
public void UpdateNode() { int level = archetypeData.GetNodeLevel(node); nodeText.text = ""; if (node.type == NodeType.ABILITY) { nodeText.text = LocalizationManager.Instance.GetLocalizationText_Ability(node.abilityId)[0]; } else { foreach (NodeScalingBonusProperty nodeBonus in node.bonuses) { nodeText.text += LocalizationManager.Instance.GetBonusTypeString(nodeBonus.bonusType) + "\n"; } foreach (TriggeredEffectBonusProperty nodeTrigger in node.triggeredEffects) { nodeText.text += LocalizationManager.Instance.GetLocalizationText_TriggeredEffect(nodeTrigger, nodeTrigger.effectMaxValue) + "\n"; } } levelText.text = level + "/" + node.maxLevel; for (int i = 0; i < node.maxLevel; i++) { if (i < level) { levelIcons[i].color = level == node.maxLevel ? MAX_LEVEL_COLOR : LEVEL_COLOR; } else { levelIcons[i].color = new Color(0.25f, 0.25f, 0.25f); } } if (level == node.maxLevel) { nodeButton.image.color = new Color(1f, 1f, 1f, 1); foreach (var x in connectedNodes) { if (archetypeData.GetNodeLevel(x.Key.node) == 0) { x.Value.color = AVAILABLE_COLOR; } else { x.Value.color = CONNECTED_COLOR; } } } else if (level > 0) { nodeButton.image.color = new Color(1f, 1f, 1f, 1); foreach (var x in connectedNodes) { if (archetypeData.GetNodeLevel(x.Key.node) > 0) { x.Value.color = CONNECTED_COLOR; } else { x.Value.color = UNAVAILABLE_COLOR; } } } else { nodeButton.image.color = new Color(0.8f, 0.8f, 0.8f, 1); foreach (var x in connectedNodes) { if (archetypeData.GetNodeLevel(x.Key.node) == x.Key.node.maxLevel) { x.Value.color = AVAILABLE_COLOR; } else { x.Value.color = UNAVAILABLE_COLOR; } } } UIManager.Instance.ArchetypeUITreeWindow.primaryTreeParent.SetAllDirty(); UIManager.Instance.ArchetypeUITreeWindow.secondaryTreeParent.SetAllDirty(); }