Exemplo n.º 1
0
        /// <summary>
        /// Add effect variable to save dictionary
        /// </summary>
        /// <param name="p_raw_effect"></param>
        public void ImplementEffect(string p_raw_effect)
        {
            if (string.IsNullOrEmpty(p_raw_effect))
            {
                return;
            }

            try
            {
                string[] attrGroup = p_raw_effect.Split('&');
                foreach (string s_attr in attrGroup)
                {
                    string[] attrValue     = s_attr.Split(' ');
                    string   trait_id      = attrValue[0];
                    string   operator_mark = attrValue[1];
                    int      intValue      = int.Parse(attrValue[2]);


                    if (ScoreDict.TryGetValue(trait_id, out int score))
                    {
                        ScoreDict[trait_id] = UtilityMethod.BasicMathOperator(operator_mark, intValue, score);
                    }
                    else
                    {
                        ScoreDict.Add(trait_id, UtilityMethod.BasicMathOperator(operator_mark, intValue, score));
                    }
                }
            }
            catch {
                Debug.LogError("AnalyzeEffect Parse Error");
            }
        }