예제 #1
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;
        }
예제 #2
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;
        }
예제 #3
0
        /// <summary>
        /// Adds FlexiFunction controls for every function in door.c that uses a side name parameter.
        /// A list of all sides is kept so that they can be easily referenced later if they need
        /// to be removed all at once.
        ///
        /// NOTE: The parameter for the side is always disabled. This is so the user doesn't screw with
        /// the consistency. This control will be enabled during saving so that the model doesn't skip it.
        /// (It skips disabled controls)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void buttonAddSide_Click(object sender, EventArgs e)
        {
            string sideName = textNewSideName.Text;

            if (sideName == null || sideName.Length < 1)
            {
                MessageBox.Show("Please provide a name for the side you wish to add to this door.");
                return;
            }

            if (SideFunctions.ContainsKey(sideName))
            {
                MessageBox.Show("The name '" + sideName + "' is already in use.");
                return;
            }

            List <FlexiFunction> temp = new List <FlexiFunction>();

            Saved = false;

            //setup SetId()
            string func = "This Direction Id";
            FunctionControlParam setIdSideParam = new FunctionControlParam("side", "Dir:", ControlType.TextEntry, FuncParamType.String, EntryType.Strings, EntryType.Strings);
            FunctionControlParam setIdNameParam = new FunctionControlParam("id", "Id:", ControlType.ListBuilder, FuncParamType.Array, EntryType.Strings, EntryType.Strings);
            FlexiFunction        setId          = new FlexiFunction("SetId" + Globals.Generator.FunctionHashSymbol + sideName, func, new FunctionControlParam[] { setIdSideParam, setIdNameParam });

            setId.Parameters[0].PushEntry(sideName);
            setId.Parameters[0].Enabled = false;

            StringBuilder s = new StringBuilder("({");

            s.Append("\"a door leading " + sideName + "\",\"" + sideName + " door\",\"door\"})");
            setId.Parameters[1].PushEntry(s.ToString());
            temp.Add(setId);


            //setup SetShort()
            func = "This Direction Short Desc";
            FunctionControlParam setShortSideParam = new FunctionControlParam("side", "Dir:", ControlType.TextEntry, FuncParamType.String, EntryType.Strings, EntryType.Strings);
            FunctionControlParam setShortNameParam = new FunctionControlParam("short", "Short:", ControlType.TextEntry, FuncParamType.String, EntryType.Strings, EntryType.Strings);
            FlexiFunction        setShort          = new FlexiFunction("SetShort" + Globals.Generator.FunctionHashSymbol + sideName, func, new FunctionControlParam[] { setShortSideParam, setShortNameParam });

            setShort.Parameters[0].PushEntry(sideName);
            setShort.Parameters[0].Enabled = false;
            setShort.Parameters[1].PushEntry("\"a door leading " + sideName + "\"");
            temp.Add(setShort);


            //SetLong()
            func = "This Direction Long Desc";
            FunctionControlParam setLongSideParam = new FunctionControlParam("side", "Dir:", ControlType.TextEntry, FuncParamType.String, EntryType.Strings, EntryType.Strings);
            FunctionControlParam setLongNameParam = new FunctionControlParam("long", "Long:", ControlType.TextEntry, FuncParamType.String, EntryType.Strings, EntryType.Strings);
            FlexiFunction        setLong          = new FlexiFunction("SetLong" + Globals.Generator.FunctionHashSymbol + sideName, func, new FunctionControlParam[] { setLongSideParam, setLongNameParam });

            setLong.Parameters[0].PushEntry(sideName);
            setLong.Parameters[0].Enabled = false;
            setLong.Parameters[1].PushEntry("\"A door leading " + sideName + ".\"");
            temp.Add(setLong);


            //SetLockable()
            func = "This Direction Lockable";
            FunctionControlParam setLockableSideParam = new FunctionControlParam("side", "Dir:", ControlType.TextEntry, FuncParamType.String, EntryType.Strings, EntryType.Strings);
            FunctionControlParam setLockableNameParam = new FunctionControlParam("lockable", "Lockable:", ControlType.CheckBox, FuncParamType.Property, EntryType.NonStrings, EntryType.NonStrings);
            FlexiFunction        setLockable          = new FlexiFunction("SetLockable" + Globals.Generator.FunctionHashSymbol + sideName, func, new FunctionControlParam[] { setLockableSideParam, setLockableNameParam });

            setLockable.Parameters[0].PushEntry(sideName);
            setLockable.Parameters[0].Enabled = false;
            temp.Add(setLockable);


            //SetKeys()
            func = "This Direction Acceptable Keys";
            FunctionControlParam setKeysSideParam = new FunctionControlParam("side", "Dir:", ControlType.TextEntry, FuncParamType.String, EntryType.Strings, EntryType.Strings);
            FunctionControlParam setKeysNameParam = new FunctionControlParam("keys", "Key Names:", ControlType.ListBuilder, FuncParamType.Array, EntryType.Strings, EntryType.Strings);
            FlexiFunction        setKeys          = new FlexiFunction("SetKeys" + Globals.Generator.FunctionHashSymbol + sideName, func, new FunctionControlParam[] { setKeysSideParam, setKeysNameParam });

            setKeys.Parameters[0].PushEntry(sideName);
            setKeys.Parameters[0].Enabled = false;
            temp.Add(setKeys);



            //when all is said and done, place controls into proper layouts
            SideFunctions.Add(sideName, temp);
            this.comboSideList.Items.Add(sideName);

            this.flowSetId.Controls.Add(setId);
            this.flowSetShort.Controls.Add(setShort);
            this.flowSetLong.Controls.Add(setLong);
            this.flowSetLockable.Controls.Add(setLockable);
            this.flowSetKeys.Controls.Add(setKeys);
        }