/// <summary>
        /// Gets a string representation of the HealthGoal.
        /// </summary>
        ///
        /// <returns>
        /// A string representation of the HealthGoal.
        /// </returns>
        ///
        public override string ToString()
        {
            if (TargetRange != null && Recurrence != null)
            {
                return(string.Format(
                           CultureInfo.CurrentUICulture,
                           Resources.HealthGoalWithTargetRangeAndRecurrenceFormat,
                           Name.Text,
                           TargetRange.ToString(),
                           Recurrence.ToString()));
            }

            if (TargetRange != null)
            {
                return(string.Format(
                           CultureInfo.CurrentUICulture,
                           Resources.HealthGoalFormat,
                           Name.Text,
                           TargetRange.ToString()));
            }

            if (Recurrence != null)
            {
                return(string.Format(
                           CultureInfo.CurrentUICulture,
                           Resources.HealthGoalFormat,
                           Name.Text,
                           Recurrence.ToString()));
            }

            return(Name.Text);
        }
Exemplo n.º 2
0
    public static void AddAllSideEffects()
    {
        Reset();
        SortedDictionary <string, string> descKeyDict = new SortedDictionary <string, string>();

        foreach (int v in Enum.GetValues(typeof(LanguageShorts)))
        {
            string strName = Enum.GetName(typeof(LanguageShorts), v);
            descKeyDict[strName] = "desc_" + strName;
        }

        string text;

        using (StreamReader sr = new StreamReader(SideEffectsXMLFile))
        {
            text = sr.ReadToEnd();
        }

        XmlDocument doc = new XmlDocument();

        doc.LoadXml(text);
        XmlElement node_AllSideEffects = doc.DocumentElement;

        for (int i = 0; i < node_AllSideEffects.ChildNodes.Count; i++)
        {
            XmlNode node_SideEffect = node_AllSideEffects.ChildNodes.Item(i);

            string         name = node_SideEffect.Attributes["name"].Value;
            SideEffectBase se   = (SideEffectBase)CurrentAssembly.CreateInstance("SideEffects." + name);

            if (se == null)
            {
                Utils.DebugLog("SideEffects: " + name + " does not exist");
                continue;
            }

            se.Name     = node_SideEffect.Attributes["name"].Value;
            se.DescRaws = new SortedDictionary <string, string>();
            foreach (KeyValuePair <string, string> kv in descKeyDict)
            {
                se.DescRaws[kv.Key] = node_SideEffect.Attributes[kv.Value].Value;
            }

            if (se is TargetSideEffect t_se)
            {
                t_se.M_SideEffectParam.GetParam("TargetSelect").SetValue(t_se.ValidTargetSelects[0].ToString());
                Dictionary <TargetSelect, List <TargetRange> > validTargetRangeDict = TargetSelector.TargetSelectorPresets[t_se.TargetSelectorType];
                TargetRange validTargetRange = validTargetRangeDict[t_se.ValidTargetSelects[0]][0];
                t_se.M_SideEffectParam.GetParam("TargetRange").SetValue(validTargetRange.ToString());
            }

            addSideEffect(se);
        }
    }
Exemplo n.º 3
0
    public override void DrawInspector()
    {
        showSpellAction.target = EditorGUILayout.ToggleLeft(name, showSpellAction.target);


        if (EditorGUILayout.BeginFadeGroup(showSpellAction.faded))
        {
            EditorGUILayout.LabelField("TargetType: " + targetType.ToString());
            EditorGUILayout.LabelField("TargetFilter: " + targetFilter.ToString());
            EditorGUILayout.LabelField("TargetRange: " + targetRange.ToString());
            EditorGUILayout.LabelField("TargetAOE: " + targetAOE.ToString());
            EditorGUILayout.LabelField("Range: " + range.ToString());
            EditorGUILayout.LabelField("Number of action events: " + protoEvents.Count.ToString());
            for (int i = 0; i < protoEvents.Count; i++)
            {
                protoEvents[i].DrawInspector();
            }
        }
        EditorGUILayout.EndFadeGroup();
    }