コード例 #1
0
 public ConditionWin(ref CTriggerDataCondition ctdc, MainForm f, ConditionWin cw)
 {
     this.ctdc = ctdc;
     this.f    = f;
     this.cw   = cw;
     InitializeComponent();
     rootcondition_center.DropDownStyle = ComboBoxStyle.DropDownList;
     rootcondition_left.DropDownStyle   = ComboBoxStyle.DropDownList;
     rootcondition_right.DropDownStyle  = ComboBoxStyle.DropDownList;
     for (int i = 0; i < 27; ++i)
     {
         rootcondition_center.Items.Add(Lang.Translate(Conditions.GetInfo(i).Name));
     }
     for (int i = 0; i < Conditions.Non_central().Length; ++i)
     {
         string name = Lang.Translate(Conditions.GetInfo(Conditions.Non_central()[i]).Name);
         rootcondition_right.Items.Add(name);
         rootcondition_left.Items.Add(name);
     }
     rootcondition_right.Items.Add(Lang.Translate("cond_subcondition"));
     rootcondition_left.Items.Add(Lang.Translate("cond_subcondition"));
     foreach (Control c in Controls)
     {
         string ui = Lang.Translate(c.Name);
         if (!string.IsNullOrEmpty(ui))
         {
             c.Text = ui;
         }
     }
     LoadCondition();
 }
コード例 #2
0
        public static void SetSubnoteByID(ref CTriggerDataCondition ctdc)
        {
            switch (ctdc.OperID)
            {
            case 6:
            case 7:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 14:
            case 15:
                ctdc.SubNodeL = 2;
                ctdc.SubNodeR = 4;
                break;

            case 5:
                ctdc.SubNodeL = 4;
                ctdc.SubNodeR = 0;
                break;

            default:
                ctdc.SubNodeL = 0;
                ctdc.SubNodeR = 0;
                break;
            }
        }
コード例 #3
0
 public CTriggerData()
 {
     version       = 0;
     szName        = new AIFile().GBKStringToBytes("");
     bActive       = false;
     bRun          = false;
     bAttackValid  = false;
     uID           = 0;
     rootConditon  = new CTriggerDataCondition();
     listOperation = new List <CTriggerDataOperation>();
 }
コード例 #4
0
 public CTriggerData(int v, int uid)
 {
     version       = v;
     szName        = new AIFile().GBKStringToBytes("new trigger");
     bActive       = true;
     bRun          = false;
     bAttackValid  = false;
     uID           = uid;
     rootConditon  = new CTriggerDataCondition();
     listOperation = new List <CTriggerDataOperation>();
 }
コード例 #5
0
        public CTriggerDataCondition LoadCondition(BinaryReader br)
        {
            CTriggerDataCondition condition = new CTriggerDataCondition();

            condition.OperID = br.ReadInt32();
            condition.Value  = br.ReadBytes(br.ReadInt32());
            condition.Type   = br.ReadInt32();
            if (condition.Type == 1)
            {
                condition.ConditionLeft  = LoadCondition(br);
                condition.SubNodeL       = br.ReadInt32();
                condition.ConditionRight = LoadCondition(br);
                condition.SubNodeR       = br.ReadInt32();
            }
            if (condition.Type == 2)
            {
                condition.ConditionRight = LoadCondition(br);
                condition.SubNodeL       = br.ReadInt32();
            }
            return(condition);
        }
コード例 #6
0
 public void SaveCondition(BinaryWriter bw, CTriggerDataCondition c)
 {
     bw.Write(c.OperID);
     bw.Write(c.Value.Length);
     bw.Write(c.Value);
     bw.Write(c.Type);
     if (c.Type == 1)
     {
         SaveCondition(bw, c.ConditionLeft);
         bw.Write(c.SubNodeL);
         if (c.SubNodeL == 2)
         {
             SaveCondition(bw, c.ConditionRight);
             bw.Write(c.SubNodeR);
         }
     }
     if (c.Type != 2)
     {
         return;
     }
     SaveCondition(bw, c.ConditionRight);
     bw.Write(c.SubNodeL);
 }
コード例 #7
0
ファイル: Form1.cs プロジェクト: Kn1fe/NextAIPolicyEditor2
        public void LoadCondition(CTriggerDataCondition ctdc)
        {
            if (ctdc.ConditionLeft == null)
            {
                ctdc.ConditionLeft = new CTriggerDataCondition();
            }
            if (ctdc.ConditionRight == null)
            {
                ctdc.ConditionRight = new CTriggerDataCondition();
            }
            disableAll();
            int index = 0;

            rootcondition_center.SelectedIndex = ctdc.OperID;
            object[] cparam = Conditions.Read(ctdc.Value, ctdc.OperID);
            if (cparam.Length > 0)
            {
                rootcondition_txt1.Visible   = true;
                rootcondition_txt1.Text      = Lang.Translate(Conditions.GetInfo(ctdc.OperID).Fields[0]);
                rootcondition_param1.Visible = true;
                rootcondition_param1.Text    = cparam[0].ToString();
                if (cparam.Length > 1)
                {
                    rootcondition_txt2.Visible   = true;
                    rootcondition_txt2.Text      = Lang.Translate(Conditions.GetInfo(ctdc.OperID).Fields[1]);
                    rootcondition_param2.Visible = true;
                    rootcondition_param2.Text    = cparam[1].ToString();
                }
            }
            if (ctdc.Type <= 2)
            {
                index = Array.IndexOf(Conditions.Non_central(), ctdc.ConditionRight.OperID);
                if (index > -1)
                {
                    rootcondition_right.Visible       = true;
                    rootcondition_right.SelectedIndex = index;
                    object[] cparamr = Conditions.Read(ctdc.ConditionRight.Value, ctdc.ConditionRight.OperID);
                    if (cparamr.Length > 0)
                    {
                        rootcondition_right_txt1.Visible   = true;
                        rootcondition_right_txt1.Text      = Lang.Translate(Conditions.GetInfo(ctdc.ConditionRight.OperID).Fields[0]);
                        rootcondition_right_param1.Visible = true;
                        rootcondition_right_param1.Text    = cparamr[0].ToString();
                        if (cparamr.Length > 1)
                        {
                            rootcondition_right_txt2.Visible   = true;
                            rootcondition_right_txt2.Text      = Lang.Translate(Conditions.GetInfo(ctdc.ConditionRight.OperID).Fields[1]);
                            rootcondition_right_param2.Visible = true;
                            rootcondition_right_param2.Text    = cparamr[1].ToString();
                        }
                    }
                }
                else
                {
                    rootcondition_right.SelectedIndex = Conditions.Non_central().Length;
                    SubConditionRight.Visible         = true;
                }
                if (ctdc.Type == 1)
                {
                    index = Array.IndexOf(Conditions.Non_central(), ctdc.ConditionLeft.OperID);
                    if (index > -1)
                    {
                        rootcondition_left.Visible       = true;
                        rootcondition_left.SelectedIndex = index;
                        object[] cparaml = Conditions.Read(ctdc.ConditionLeft.Value, ctdc.ConditionLeft.OperID);
                        if (cparaml.Length > 0)
                        {
                            rootcondition_left_txt1.Visible   = true;
                            rootcondition_left_txt1.Text      = Lang.Translate(Conditions.GetInfo(ctdc.ConditionLeft.OperID).Fields[0]);
                            rootcondition_left_param1.Visible = true;
                            rootcondition_left_param1.Text    = cparaml[0].ToString();
                            if (cparaml.Length > 1)
                            {
                                rootcondition_left_txt2.Visible   = true;
                                rootcondition_left_txt2.Text      = Lang.Translate(Conditions.GetInfo(ctdc.ConditionLeft.OperID).Fields[1]);
                                rootcondition_left_param2.Visible = true;
                                rootcondition_left_param2.Text    = cparaml[1].ToString();
                            }
                        }
                    }
                    else
                    {
                        rootcondition_left.SelectedIndex = Conditions.Non_central().Length;
                        SubConditionLeft.Visible         = true;
                    }
                }
            }
        }