Exemplo n.º 1
0
        private void BuildScriptActionView(ScriptAction p_Action, Framework.ContextVar p_Parent)
        {
            var     l_Type = Game.ActionTypes.Instance.GetType(p_Action.Type);
            string  l_Name = "[ACTION.ID=" + p_Action.ID.ToString() + "][" + l_Type.Name + "] => " + p_Action.Comment.Replace("\\n", " | ");

            Framework.ContextVar l_Var = new Framework.ContextVar();

            l_Var.SetValue("Type", l_Type.Name);
            l_Var.SetValue("Parameter 1 (" + l_Type.Param1 + ")", p_Action.Params[0].ToString());
            l_Var.SetValue("Parameter 2 (" + l_Type.Param2 + ")", p_Action.Params[1].ToString());
            l_Var.SetValue("Parameter 3 (" + l_Type.Param3 + ")", p_Action.Params[2].ToString());
            l_Var.SetValue("Parameter 4 (" + l_Type.Param4 + ")", p_Action.Params[3].ToString());
            l_Var.SetValue("Parameter 5 (" + l_Type.Param5 + ")", p_Action.Params[4].ToString());
            l_Var.SetValue("Parameter 6 (" + l_Type.Param6 + ")", p_Action.Params[5].ToString());

            l_Var.SetValue("Comment", p_Action.Comment.Replace("\\n", "\n"));

            var l_TargetType = Game.TargetTypes.Instance.GetType(p_Action.Type);

            l_Var.SetValue("Target Type", l_TargetType.Name);
            l_Var.SetValue("Target Parameter 1 (" + l_TargetType.Param1 + ")", p_Action.TargetParams[0].ToString());
            l_Var.SetValue("Target Parameter 2 (" + l_TargetType.Param2 + ")", p_Action.TargetParams[1].ToString());
            l_Var.SetValue("Target Parameter 3 (" + l_TargetType.Param3 + ")", p_Action.TargetParams[2].ToString());

            l_Var.SetValue("Target X", p_Action.TargetX.ToString());
            l_Var.SetValue("Target Y", p_Action.TargetY.ToString());
            l_Var.SetValue("Target Z", p_Action.TargetZ.ToString());
            l_Var.SetValue("Target O", p_Action.TargetO.ToString());

            p_Parent.SetValue(l_Name, l_Var);
        }
        /// <summary>
        /// Constructor
        /// </summary>
        public ActionManager(ScriptAction p_Current, ScriptEvent p_Event, bool p_Create)
        {
            InitializeComponent();

            InitializationActionTypes();
            InitializationTargetTypes();

            TargetParameter1Description.Text = "";
            TargetParameter2Description.Text = "";
            TargetParameter3Description.Text = "";

            ActionParameter1Description.Text = "";
            ActionParameter2Description.Text = "";
            ActionParameter3Description.Text = "";
            ActionParameter4Description.Text = "";
            ActionParameter5Description.Text = "";
            ActionParameter6Description.Text = "";

            m_Current       = p_Current;
            m_Event         = p_Event;
            m_IsCreation    = p_Create;

            if (!p_Create && p_Current != null)
            {
                int l_CurrentIndex = 0;
                foreach (var l_Type in Game.ActionTypes.Instance.Types)
                {
                    if ((p_Current.Type & l_Type.Value) != 0)
                    {
                        ActionType.SelectedIndices.Add(l_CurrentIndex);
                        break;
                    }

                    l_CurrentIndex++;
                }
                ActionType_SelectedIndexChanged(this, null);

                l_CurrentIndex = 0;
                foreach (var l_Type in Game.TargetTypes.Instance.Types)
                {
                    if ((p_Current.Type & l_Type.Value) != 0)
                    {
                        TargetType.SelectedIndices.Add(l_CurrentIndex);
                        break;
                    }

                    l_CurrentIndex++;
                }
                TargetType_SelectedIndexChanged(this, null);

                ActionParameter1.Text = p_Current.Params[0].ToString();
                ActionParameter2.Text = p_Current.Params[1].ToString();
                ActionParameter3.Text = p_Current.Params[2].ToString();
                ActionParameter4.Text = p_Current.Params[3].ToString();
                ActionParameter5.Text = p_Current.Params[4].ToString();
                ActionParameter6.Text = p_Current.Params[5].ToString();

                TargetParameter1.Text = p_Current.TargetParams[0].ToString();
                TargetParameter2.Text = p_Current.TargetParams[1].ToString();
                TargetParameter3.Text = p_Current.TargetParams[2].ToString();

                TargetX.Text = p_Current.TargetX.ToString();
                TargetY.Text = p_Current.TargetY.ToString();
                TargetZ.Text = p_Current.TargetZ.ToString();
                TargetO.Text = p_Current.TargetO.ToString();

                Comment.Text = p_Current.Comment.Replace("\\n", "\n");
            }
        }