Example #1
0
        //Display the event's name, offset and parameters.
        public void DisplayEvent()
        {
            lstParameters.Items.Clear();
            cboType.SelectedIndex    = -1;
            cboType.Text             = "";
            cboType.Enabled          = false;
            lblParamDescription.Text = "No Description Available.";

            valueGrid.Visible        = false;
            requirementPanel.Visible = false;
            offsetPanel.Visible      = false;

            ActionEventInfo info = null;

            if (eventData.Root.EventDictionary.ContainsKey(eventData._event))
            {
                info = eventData.Root.EventDictionary[eventData._event];
            }

            if (info != null)
            {
                lblEventName.Text = info._name;
            }

            lblEventId.Text = MParams.Hex8(eventData._event);

            foreach (MoveDefEventParameterNode n in eventData.Children)
            {
                if (!String.IsNullOrEmpty(n.Name))
                {
                    lstParameters.Items.Add(n.Name);
                }
            }
        }
Example #2
0
 private void lstEvents_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lstEvents.SelectedIndex == -1)
     {
         return;
     }
     txtEventId.Text = MParams.Hex8((lstEvents.SelectedItem as ActionEventInfo).idNumber);
 }
Example #3
0
        public void Setup()
        {
            //Add each event to the event list, but omit any events lacking a formal name.
            if (lstEvents.Items.Count <= 0)
            {
                foreach (ActionEventInfo e in p.EventDictionary.Values)
                {
                    if (!(e._name == null || e._name == ""))
                    {
                        lstEvents.Items.Add(e);
                    }
                }
            }

            txtEventId.Text = MParams.Hex8(eventEvent);
            status          = DialogResult.Cancel;
        }
Example #4
0
        private void txtEventId_TextChanged(object sender, EventArgs e)
        {
            if (txtEventId.Text.Length != 8)
            {
                return;
            }
            string eventId = txtEventId.Text;

            //Select the event corresponding to the id input.
            lstEvents.SelectedIndex = -1;
            for (int i = 0; i < lstEvents.Items.Count; i++)
            {
                if (eventId == MParams.Hex8((lstEvents.Items[i] as ActionEventInfo).idNumber))
                {
                    lstEvents.SelectedIndex = i;
                    break;
                }
            }
        }
Example #5
0
        //Return the string result from the passed keyword and its parameters.
        public string ResolveKeyword(string keyword, string[] Params, Event eventData)
        {
            switch (keyword)
            {
            case "\\value":
                try { return(ResolveParamTypes(eventData)[int.Parse(Params[0])]); }
                catch { return("Value-" + Params[0]); }

            case "\\type":
                try { return(eventData.parameters[int.Parse(Params[0])]._type.ToString()); }
                catch { return("Type-" + Params[0]); }

            case "\\if":
                bool compare = false;
                try
                {
                    switch (Params[1])
                    {
                    case "==": compare = int.Parse(Params[0]) == int.Parse(Params[2]); break;

                    case "!=": compare = int.Parse(Params[0]) != int.Parse(Params[2]); break;

                    case ">=": compare = int.Parse(Params[0]) >= int.Parse(Params[2]); break;

                    case "<=": compare = int.Parse(Params[0]) <= int.Parse(Params[2]); break;

                    case ">": compare = int.Parse(Params[0]) > int.Parse(Params[2]); break;

                    case "<": compare = int.Parse(Params[0]) < int.Parse(Params[2]); break;
                    }
                }
                finally { }
                if (compare)
                {
                    return(Params[3]);
                }
                else
                {
                    return(Params[4]);
                }

            case "\\bone":
                try
                {
                    int id = MParams.UnHex(Params[0]);
                    if (id >= 400)
                    {
                        id -= 400;
                    }
                    if (_targetNode.Model != null && _targetNode.Model._linker.BoneCache != null && _targetNode.Model._linker.BoneCache.Length > id && id >= 0)
                    {
                        return(_targetNode.Model._linker.BoneCache[id].Name);
                    }
                    else
                    {
                        return(id.ToString());
                    }
                }
                catch { return(int.Parse(Params[0]).ToString()); }

            case "\\unhex":
                try { return(MParams.UnHex(Params[0]).ToString()); }
                catch { return(Params[0]); }

            case "\\hex":
                try { return(MParams.Hex(int.Parse(Params[0]))); }
                catch { return(Params[0]); }

            case "\\hex8":
                try { return(MParams.Hex8(int.Parse(Params[0]))); }
                catch { return(Params[0]); }

            case "\\half1":
                return(MParams.WordH(Params[0], 0));

            case "\\half2":
                return(MParams.WordH(Params[0], 1));

            case "\\byte1":
                return(MParams.WordB(Params[0], 0));

            case "\\byte2":
                return(MParams.WordB(Params[0], 1));

            case "\\byte3":
                return(MParams.WordB(Params[0], 2));

            case "\\byte4":
                return(MParams.WordB(Params[0], 3));

            case "\\collision":
                try { return(GetCollisionStatus(MParams.UnHex(Params[0]))); }
                catch { return(Params[0]); }

            case "\\airground":
                try { return(GetAirGroundStatus(MParams.UnHex(Params[0]))); }
                catch { return(Params[0]); }

            case "\\enum":
                try { return(GetEnum(int.Parse(Params[1]), MParams.UnHex(Params[0]), eventData)); }
                catch { return("Undefined(" + Params[1] + ")"); }

            case "\\cmpsign":
                try { return(MParams.GetComparisonSign(MParams.UnHex(Params[0]))); }
                catch { return(Params[0]); }

            case "\\name":
                return(GetEventInfo(eventData.eventEvent)._name);

            case "\\white":
                return(" ");

            default:
                return("");
            }
        }