Beispiel #1
0
        int CreateControl_Def(int ParaCode, int i, string lpStr = null)
        {
            int ControlNum = 0;

            switch (ParaCode)
            {
            case 4:
            case 0x102:
                CreateTextBox(m_TextBoxNum++, i, 0, 0x10000, false, lpStr);
                ControlNum = 1;
                break;

            case 5:
                m_DlgAlign.MoveToNextLine();
                CreateStrBox(m_StrBoxNum++, i, lpStr);
                m_DlgAlign.MoveToNextLine();
                break;

            case 0x26:
                if (lpStr == null)
                {
                    lpStr = CScenario.GetParameterName_Int(0x26, 1, cmd.id, i);
                }
                CreateCheckBox(m_CheckBoxNum++, i, lpStr);
                ControlNum = 1;
                break;

            case 0x100:
                CreatePosBox(m_PosBoxNum++, i, lpStr);
                ControlNum = 2;
                break;

            case 0x101:
                CreateAreaBox(m_AreaBoxNum++, i, lpStr);
                ControlNum = 4;
                break;

            default:
            {
                ParaTypeInfo TypeInfo = CScenario.GetParaTypeInfo(ParaCode);
                if (TypeInfo.IsUseCombo)
                {
                    CreateComboBox(m_ComboBoxNum++, i, lpStr);
                }
                else
                {
                    CreateTextBox(m_TextBoxNum++, i, 0, 0xffff, true, lpStr);
                }
                ControlNum = 1;
            }
            break;
            }
            return(ControlNum);
        }
Beispiel #2
0
        public Object newFieldValue(int fieldId)
        {
            ParaTypeInfo TypeInfo = CScenario.GetParaTypeInfo(fieldId);
            EexType      etype    = ScriptConfig.Instance.getEexType(fieldId);

            switch (etype)
            {
            case EexType.EexString:
            {
                string ret = "";
                return(ret);
            }

            case EexType.EexBoolean:
            {
                return(false);
            }

            case EexType.EexInteger:
                if (!TypeInfo.isAllowNULL)
                {
                    return(0);
                }
                else
                {
                    return(TypeInfo.DefIndex == 0x10000 ? 0xFFFF : TypeInfo.DefIndex);
                }

            case EexType.EexUShort:
                if (!TypeInfo.isAllowNULL)
                {
                    return((ushort)0);
                }
                else
                {
                    return(TypeInfo.DefIndex == 0x10000 ? (ushort)0xFFFF : (ushort)TypeInfo.DefIndex);
                }

            case EexType.EexUShortArray:
            {
                ushort[] result = new ushort[0];

                return(result);
            }

            default:
                throw new EexReaderException(String.Format("unknow type={0}", etype.ToString()));
            }
        }
Beispiel #3
0
        void CreateComboBox(int Index, int ParaIndex, string lpStr, int MaxCharNum = 0)
        {
            if (ParaIndex != (-1))
            {
                ParaTypeInfo TypeInfo = CScenario.GetParaTypeInfo((int)cmd.Keys[ParaIndex]);
                //m_ComboBox[Index].SelectedIndex = (ushort)cmd.Values[ParaIndex];
                //m_ComboBox[Index].SetDefValue(CScenario.GetStepPara_Int(m_StepIndex,ParaIndex));
                //m_ComboBox[Index].SetDataInfo(m_Scenario,m_StepIndex,ParaIndex);
                m_ComboBox[Index].InitData(cmd, ParaIndex, int.Parse(cmd.Values[ParaIndex].ToString()));
                m_ComboBox[Index].N_paraIndex = ParaIndex;
                MaxCharNum = TypeInfo.MaxNameLen;
            }
            MaxCharNum = (4 > MaxCharNum?4:MaxCharNum);

            CreateStatic(m_Static_2[Index], ParaIndex, lpStr);
            int Left = m_DlgAlign.GetLastLeft();

            Create_ComboBox(m_ComboBox[Index], MaxCharNum, 0);
            m_DlgAlign.SetLastLeft(Left);
        }
Beispiel #4
0
        void OnInitDialog()
        {
            int i = 0;
            int t;
            int CharLimit = CAOCAO_CHARLIMIT;
            int m_Code    = cmd.Id;
            int Num       = cmd.Keys.Length;
            int ParaCode;

            switch (m_Code)
            {
            case 5:
                CreateCodeSelBox(m_CodeSelBoxNum++);
                break;

            case 6:
            case 0x4a:
            {
                if (m_Code == 6)
                {
                    CreateCheckBox(m_CheckBoxNum++, i++, ("出场限制"));
                }
                CreateTextBox(m_TextBoxNum++, i++, 0, 0x10000 + 15, false, ("人数限制"));
                m_DlgAlign.MoveToNextLine();
                t = i;
                CreateListBox(0, (-1), ("出场限制"), 10);
                m_DlgAlign.MoveToNextLine(false, false);
                m_DlgAlign.MoveTopBack();
                m_DlgAlign.MoveToRight();
                int ListBoxWidth = m_DlgAlign.GetLastWidth();
                for (i = 0; i < CharLimit + CharLimit; i++)
                {
                    m_ListBox[0].Items.Add((i < CharLimit) ? ("强制出场") : ("强制不出场"));
                    //m_ListBox[0].SetItemData(i,i);
                }

                m_ListBox[0].SelectedIndex = 0;
                m_DlgAlign.MoveToNextLine();
                m_DlgAlign.MoveTopBack();

                m_DlgAlign.SetLastWidth(ListBoxWidth);
                m_DlgAlign.MoveToRight();
                ParaCode = cmd.Keys[t];
                CreateControl_Def(ParaCode, t, ("武将"));
            }
            break;

            case 0x32:
            case 0x4c:
            case 0x55:
            case 0x6d:
                CreateControl_Def(0x40, i++);
                t = m_ComboBox[m_ComboBoxNum - 1].SelectedIndex;
                CreateControl_Def(0x2, i++);
                m_DlgAlign.MoveLeftBack();
                ShowComboBox(m_ComboBoxNum - 1, (t == 0));
                CreateTextBox(m_TextBoxNum++, i++, 0, 0x10000 + 114, false, ("BFIndex"));
                m_DlgAlign.MoveLeftBack();
                ShowTextBox(m_TextBoxNum - 1, (t == 1));
                if (m_Code == 0x32 || m_Code == 0x55)
                {
                    m_DlgAlign.MoveToNextLine();
                    CreateControl_Def(0x100, i++);
                    CreateControl_Def(0x2b, i++);
                }
                if (m_Code == 0x6d)
                {
                    m_DlgAlign.MoveToNextLine();
                    for (; i < Num; i++)
                    {
                        if (i == 5)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        ParaCode = cmd.Keys[i];
                        CreateControl_Def(ParaCode, i);
                    }
                }
                break;

            case 0x46:
            {
                ParaTypeInfo TypeInfo = CScenario.GetParaTypeInfo(2);
                CreateListBox(0, (-1), ("友军出场人物"), TypeInfo.MaxNameLen);
                m_DlgAlign.MoveToNextLine(false, false);
                m_DlgAlign.MoveTopBack();
                m_DlgAlign.MoveToRight();
                int ListBoxWidth = m_DlgAlign.GetLastWidth();
                for (i = 0; i < 20; i++)
                {
                    //t=CScenario.GetStepPara_Int(m_StepIndex,i*9);
                    t = (int)cmd.ArrayValues[i][0];
                    //m_ListBox[0].AddString(CScenario.GetParameterName_Int(0x2,t));
                    //m_ListBox[0].SetItemData(i,i);
                }
                m_ListBox[0].SelectedIndex = 0;
                m_DlgAlign.MoveToNextLine();
                m_DlgAlign.MoveTopBack();
                t = 0;               //in case "potentially uninitialized local variable 't' used"
                for (i = 0; i < Num / 20; i++)
                {
                    m_DlgAlign.SetLastWidth(ListBoxWidth);
                    if (i != 8)
                    {
                        m_DlgAlign.MoveToRight();
                    }
                    ParaCode = cmd.Keys[i];
                    CreateControl_Def(ParaCode, i);
                    if (i != 7)
                    {
                        m_DlgAlign.MoveToNextLine();
                    }
                    //if (i==2 || i==5)
                    //m_DlgAlign.MoveToNextLine();
                    if (i == 6)
                    {
                        t = m_ComboBox[m_ComboBoxNum - 1].SelectedIndex;
                    }
                    else if (i == 7)
                    {
                        m_DlgAlign.MoveLeftBack();
                        ShowComboBox(m_ComboBoxNum - 1, (t == 3 || t == 5));
                    }
                    else if (i == 8)
                    {
                        //m_DlgAlign.MoveLeftBack();
                        ShowPosBox(m_PosBoxNum - 1, (t == 4 || t == 6));
                    }
                }
            }
            break;

            case 0x47:
            {
                ParaTypeInfo TypeInfo = CScenario.GetParaTypeInfo(2);
                CreateListBox(0, (-1), ("敌军出场人物"), TypeInfo.MaxNameLen);
                m_DlgAlign.MoveToNextLine(false, false);
                m_DlgAlign.MoveTopBack();
                m_DlgAlign.MoveToRight();
                int ListBoxWidth = m_DlgAlign.GetLastWidth();
                for (i = 0; i < 80; i++)
                {
                    //t=CScenario.GetStepPara_Int(m_StepIndex,i*10);
                    t = (int)cmd.ArrayValues[i][0];
                    m_ListBox[0].Items.Add(CScenario.GetParameterName_Int(0x2, t));
                    //m_ListBox[0].AddString(CScenario.GetParameterName_Int(0x2,t));
                    //m_ListBox[0].SetItemData(i,i);
                }
                m_ListBox[0].SelectedIndex = (0);
                m_DlgAlign.MoveToNextLine();
                m_DlgAlign.MoveTopBack();
                t = 0;                       //in case "potentially uninitialized local variable 't' used"
                for (i = 0; i < Num / 80; i++)
                {
                    m_DlgAlign.SetLastWidth(ListBoxWidth);
                    if (i != 2 && i != 9)
                    {
                        m_DlgAlign.MoveToRight();
                    }
                    ParaCode = cmd.Keys[i];
                    CreateControl_Def(ParaCode, i);
                    if (i != 1 && i != 8)
                    {
                        m_DlgAlign.MoveToNextLine();
                    }
                    if (i == 7)
                    {
                        t = m_ComboBox[m_ComboBoxNum - 1].SelectedIndex;
                    }
                    else if (i == 8)
                    {
                        m_DlgAlign.MoveLeftBack();
                        ShowComboBox(m_ComboBoxNum - 1, (t == 3 || t == 5));
                    }
                    else if (i == 9)
                    {
                        ShowPosBox(m_PosBoxNum - 1, (t == 4 || t == 6));
                    }
                }
            }
            break;

            case 0x4b:
                CreateTextBox(m_TextBoxNum++, i++, 0, 0x10000 + 14, false, ("BFIndex"));
                for (; i < Num; i++)
                {
                    ParaCode = cmd.Keys[i];
                    CreateControl_Def(ParaCode, i);
                }
                break;

            case 0x4d:
                CreateControl_Def(0x41, i++);
                t = m_ComboBox[m_ComboBoxNum - 1].SelectedIndex;
                m_DlgAlign.MoveToNextLine();
                CreateControl_Def(0x2, i++);
                m_DlgAlign.MoveLeftBack();
                ShowComboBox(m_ComboBoxNum - 1, (t == 0));
                CreateTextBox(m_TextBoxNum++, i++, 0, 0x10000 + 114, false, ("BFIndex"));
                m_DlgAlign.MoveLeftBack();
                ShowTextBox(m_TextBoxNum - 1, (t == 1));
                CreateControl_Def(0x101, i++);
                CreateControl_Def(0x3, i++);
                m_DlgAlign.MoveLeftBack();
                ShowAreaBox(m_AreaBoxNum - 1, (t == 2));
                ShowComboBox(m_ComboBoxNum - 1, (t == 2));
                m_DlgAlign.MoveToNextLine();
                CreateControl_Def(0x2f, i++);
                CreateControl_Def(0x18, i++);
                CreateControl_Def(0x30, i++);
                m_DlgAlign.MoveToNextLine();
                CreateControl_Def(0x4, i++, ("-HP"));
                CreateControl_Def(0x4, i++, ("-MP"));
                break;

            case 0x100:
            {
                ParaTypeInfo TypeInfo = CScenario.GetParaTypeInfo(0x100);
                CreateComboBox(0, (-1), ("代码"), TypeInfo.MaxNameLen);
                //m_ComboBox[0].SetScrollRange()
                for (i = 0; i < TypeInfo.NameNum; i++)
                {
                    //t=CScenario.GetParaTypeNameIndex(0x100,i);
                    //m_ComboBox[0].AddString(CScenario.GetParameterName_Int(0x100,t));
                    //m_ComboBox[0].SetItemData(i,t);
                    //if (int(m_CodeSelect)==t || (m_CodeSelect==-1 && t==5)) m_ComboBox[0].SetCurSel(i);
                }
            }
            break;

            default:
            {
                int ControlNum = 0;
                t = 0;       //in case "potentially uninitialized local variable 't' used"
                for (i = 0; i < Num; i++)
                {
                    ParaCode    = cmd.Keys[i];
                    ControlNum += CreateControl_Def(ParaCode, i);
                    switch (m_Code)
                    {
                    case 0x27:
                        if (i == 0)
                        {
                            m_DlgAlign.MoveToNextLine();
                            t = m_ComboBox[m_ComboBoxNum - 1].SelectedIndex;
                        }
                        else
                        {
                            m_DlgAlign.MoveLeftBack();
                            ShowComboBox(m_ComboBoxNum - 1, (i == t + 1));
                        }
                        break;

                    case 0x31:
                    case 0x4e:
                    case 0x53:
                        //0x31 i==0 || i==1
                        switch (i)
                        {
                        case 0:
                            m_DlgAlign.MoveToNextLine();
                            t = m_ComboBox[m_ComboBoxNum - 1].SelectedIndex;
                            break;

                        case 1:
                            ShowComboBox(m_ComboBoxNum - 1, (t == 0));
                            m_DlgAlign.MoveLeftBack();
                            break;

                        case 2:
                            ShowAreaBox(m_AreaBoxNum - 1, (t == 1));
                            break;

                        case 3:
                            m_DlgAlign.MoveToNextLine();
                            ShowComboBox(m_ComboBoxNum - 1, (t == 1));
                            break;

                        case 4:
                            if (m_Code == 0x4e)
                            {
                                t = m_ComboBox[m_ComboBoxNum - 1].SelectedIndex;
                            }
                            break;

                        case 5:
                            if (m_Code == 0x4e)
                            {
                                m_DlgAlign.MoveLeftBack();
                                ShowComboBox(m_ComboBoxNum - 1, (t == 3 || t == 5));
                            }
                            break;

                        case 6:
                            if (m_Code == 0x4e)
                            {
                                m_DlgAlign.MoveLeftBack();
                                ShowPosBox(m_PosBoxNum - 1, (t == 4 || t == 6));
                            }
                            break;
                        }
                        break;

                    case 0x3d:
                    case 0x4f:
                        if (i == 2)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        break;

                    case 0x3e:
                    case 0x48:
                        if (i == 0 || i == 2 || i == 4)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        break;

                    case 0x41:
                        if (i == 2)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        else if (i == 3)
                        {
                            t = m_ComboBox[m_ComboBoxNum - 1].SelectedIndex;
                        }
                        else if (i == 4)
                        {
                            ShowAreaBox(m_AreaBoxNum - 1, (t == 1));
                        }
                        break;

                    case 0x45:
                        if (i == 1 || i == 3 || i == 7)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        break;

                    case 0x50:
                        if (i == 1)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        break;

                    case 0x58:
                        if (i == 3)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        break;

                    case 0x59:
                        if (i == 0 || i == 2 || i == 4 || i == 6)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        break;

                    case 0x67:
                        if (i == 0)
                        {
                            m_DlgAlign.MoveToNextLine();
                        }
                        break;

                    default:
                        if (ControlNum >= 5)
                        {
                            m_DlgAlign.MoveToNextLine();
                            ControlNum = 0;
                        }
                        break;
                    }
                }
            }
            break;
            }
            m_DlgAlign.MoveToNextLine();
            if (m_DlgAlign.GetWidthMax() < 200)
            {
                this.Width = m_DlgAlign.GetWidthMax();
            }
            else
            {
                this.Width = m_DlgAlign.GetWidthMax() + 30;
            }
            this.Height = m_DlgAlign.GetHeightMax() + 80;



            //PlaceOKCancelButton();

            string WinCaption = CScenario.GetCodeName(m_Code);

            if (m_Code < 0x100)
            {
                this.Text = ("修改-") + WinCaption;
            }
            else if (m_Code >= 0x100 && m_Code <= 0x100)
            {
                this.Text = "选择代码";
            }
        }