コード例 #1
0
 public void AddDescription(EventDecision description)
 {
     playerResourceLacking = false;
     isClicked             = false;
     curDecision           = description;
     optionDecription.text = curDecision.optionDescription;
     UpdateKingdomResources();
 }
コード例 #2
0
        public void DecisionOption(EventDecision thisDecision)
        {
            bool addReward    = false;
            bool removeReward = false;

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField("Decision Words:", GUILayout.MaxWidth(90));
            thisDecision.optionDescription = EditorGUILayout.TextArea(thisDecision.optionDescription, GUILayout.MaxHeight(15), GUILayout.MaxWidth(350));
            EditorGUILayout.LabelField("Add Rewards:", GUILayout.MaxWidth(80));
            addReward    = GUILayout.Button("+", GUILayout.MaxWidth(50));
            removeReward = GUILayout.Button("-", GUILayout.MaxWidth(50));
            EditorGUILayout.EndHorizontal();

            if (addReward)
            {
                addReward = false;
                if (thisDecision.rewards == null)
                {
                    thisDecision.rewards = new List <ResourceReward>();
                }
                if (thisDecision.rewards.Count < 4)
                {
                    thisDecision.rewards.Add(new ResourceReward());
                }
            }
            else if (removeReward)
            {
                removeReward = false;
                if (thisDecision.rewards != null && thisDecision.rewards.Count > 0)
                {
                    thisDecision.rewards.RemoveAt(thisDecision.rewards.Count - 1);
                }
            }
            if (thisDecision.rewards != null)
            {
                EditorGUILayout.BeginHorizontal();
                for (int i = 0; i < thisDecision.rewards.Count; i++)
                {
                    thisDecision.rewards[i].resourceType = (ResourceType)EditorGUILayout.EnumPopup(
                        "Type:",
                        thisDecision.rewards[i].resourceType, GUILayout.MaxWidth(75));
                    thisDecision.rewards[i].rewardAmount = EditorGUILayout.IntField("Amount:", thisDecision.rewards[i].rewardAmount, GUILayout.MaxWidth(75));
                }
                EditorGUILayout.EndHorizontal();
            }
        }