Beispiel #1
0
        private void RemoveAction(FunctionCallId funcid, FlowLayoutPanel target)
        {
            if (target.Controls == null || target.Controls.Count < 1)
            {
                return;
            }

            #region verify firstParam
            switch (funcid)
            {
            case FunctionCallId.SetAction:
            {
                break;
            }

            case FunctionCallId.SetSkill:
            {
                break;
            }
            }
            #endregion

            Saved = false;

            //HACK ALERT! I am assuming that the last control was the last one added as well.
            //This could very well change dynamically. DO SOME RESERACH!
            target.Controls.RemoveAt(target.Controls.Count - 1);
        }
Beispiel #2
0
        private void RemoveStatOrSkillFunctionCall(FunctionCallId funcid, string firstParam, FlowLayoutPanel target, ComboBox listsubtraction)
        {
            if (firstParam == null || firstParam.Length < 1)
            {
                return;
            }

            Dictionary <string, FlexiFunction> functions = new Dictionary <string, FlexiFunction>();
            string funcText = "";


            #region verify firstParam
            switch (funcid)
            {
            case FunctionCallId.SetStat:
            {
                if (!StatFunctions.ContainsKey(firstParam))
                {
                    return;
                }

                functions = this.StatFunctions;
                funcText  = "Stat";
                break;
            }

            case FunctionCallId.SetSkill:
            {
                if (!SkillFunctions.ContainsKey(firstParam))
                {
                    return;
                }

                functions = this.SkillFunctions;
                funcText  = "Skill";
                break;
            }

            case FunctionCallId.AddLanguagePoints:
            {
                if (!LanguageFunctions.ContainsKey(firstParam))
                {
                    return;
                }

                functions = this.LanguageFunctions;
                funcText  = "Language";
                break;
            }
            }
            #endregion

            Saved = false;

            target.Controls.Remove(functions[firstParam]);
            functions.Remove(firstParam);
            listsubtraction.Items.Remove(firstParam);
        }
Beispiel #3
0
        private void AddAction(FunctionCallId funcid, string functionName, FlowLayoutPanel target)
        {
            string funcText = "";
            int    count    = 0;


            #region verify firstParam
            switch (funcid)
            {
            case FunctionCallId.SetAction:
            {
                ActionCount++;
                count    = ActionCount;
                funcText = "Actions";
                break;
            }

            case FunctionCallId.SetCombatAction:
            {
                CombatActionCount++;
                count    = CombatActionCount;
                funcText = "Combat Actions";
                break;
            }
            }
            #endregion


            Saved = false;

            //setup the multi-paramed function call
            FunctionControlParam setChanceParam = new FunctionControlParam("chance", "Chance / Heartbeat:", ControlType.NumberEntry, FuncParamType.Number, EntryType.NonStrings, EntryType.NonStrings);
            FunctionControlParam setResultParam = new FunctionControlParam("value", "Value:", ControlType.ListBuilder, FuncParamType.Array, EntryType.Mixed, EntryType.Mixed);
            //removed the instance number for the funtion: FlexiFunction setSkillOrStat = new FlexiFunction(functionName + Globals.Generator.FunctionHashSymbol + Convert.ToString(count),funcText,new FunctionControlParam[] { setChanceParam,setResultParam });
            FlexiFunction setSkillOrStat = new FlexiFunction(functionName, funcText, new FunctionControlParam[] { setChanceParam, setResultParam });

            target.Controls.Add(setSkillOrStat);
            return;
        }
Beispiel #4
0
        private void AddStatOrSkillFunctionCall(FunctionCallId funcid, string functionName, string firstParam, FlowLayoutPanel target, ComboBox listaddition)
        {
            firstParam = firstParam.Trim();
            if (firstParam == null || firstParam.Length < 1 || firstParam == string.Empty)
            {
                return;
            }

            Dictionary <string, FlexiFunction> functions = new Dictionary <string, FlexiFunction>();
            string funcText = "";


            #region verify firstParam
            switch (funcid)
            {
            case FunctionCallId.SetStat:
            {
                if (StatFunctions.ContainsKey(firstParam))
                {
                    MessageBox.Show("The name '" + firstParam + "' is already in use.");
                    return;
                }
                functions = this.StatFunctions;
                funcText  = "Stat";
                break;
            }

            case FunctionCallId.SetSkill:
            {
                if (SkillFunctions.ContainsKey(firstParam))
                {
                    MessageBox.Show("The name '" + firstParam + "' is already in use.");
                    return;
                }
                functions = this.SkillFunctions;
                funcText  = "Skill";
                break;
            }

            case FunctionCallId.AddLanguagePoints:
            {
                if (LanguageFunctions.ContainsKey(firstParam))
                {
                    MessageBox.Show("The name '" + firstParam + "' is already in use.");
                    return;
                }
                functions = this.LanguageFunctions;
                funcText  = "Language";
                break;
            }
            }
            #endregion


            Saved = false;

            //setup the multi-paramed function call
            FunctionControlParam setNameParam   = new FunctionControlParam("name", "Name:", ControlType.TextEntry, FuncParamType.String, EntryType.Strings, EntryType.Strings);
            FunctionControlParam setValueParam  = new FunctionControlParam("value", "Value:", ControlType.NumberEntry, FuncParamType.Number, EntryType.NonStrings, EntryType.NonStrings);
            FlexiFunction        setSkillOrStat = new FlexiFunction(functionName + Globals.Generator.FunctionHashSymbol + firstParam, funcText, new FunctionControlParam[] { setNameParam, setValueParam });
            setSkillOrStat.Parameters[0].PushEntry(firstParam);
            setSkillOrStat.Parameters[0].Enabled = false;


            //when all is said and done, place controls into proper layouts
            functions.Add(firstParam, setSkillOrStat);
            target.Controls.Add(setSkillOrStat);
            if (listaddition != null)
            {
                listaddition.Items.Add(firstParam);
            }

            return;
        }