コード例 #1
0
ファイル: IGM_Items.cs プロジェクト: stantoxt/OpenVIII
        protected override void Init()
        {
            Size = new Vector2 {
                X = 840, Y = 630
            };
            base.Init();
            var actions = new Action[]
            {
                () => Data.TryAdd(SectionName.Help, new IGMDataItem.HelpBox {
                    Pos = new Rectangle(15, 69, 810, 78), Title = Icons.ID.HELP, Options = Box_Options.Middle
                }),
                () => {
                    var keys = new FF8String[] {
                        Strings.Name.Use, //todo add to Strings.Name
                        Strings.Name.Rearrange,
                        Strings.Name.Sort,
                        Strings.Name.Battle
                    };
                    var values = new FF8String[] {
                        Strings.Description.Use, //todo add to Strings.Description
                        Strings.Description.Rearrange,
                        Strings.Description.Sort,
                        Strings.Description.Battle
                    };
                    if (keys.Distinct().Count() == keys.Length && keys.Length == values.Length)
                    {
                        Data.TryAdd(SectionName.TopMenu, TopMenu.Create((from i in Enumerable.Range(0, keys.Length) select i).ToDictionary(x => keys[x], x => values[x])));
                    }
                    else
                    {
                        Data.TryAdd(SectionName.TopMenu, null);
                    }
                },
                () => Data.TryAdd(SectionName.Title, new IGMDataItem.Box {
                    Data = Memory.Strings.Read(Strings.FileID.MenuGroup, 0, 2), Pos = new Rectangle(615, 0, 225, 66)
                }),
                () => Data.TryAdd(SectionName.UseItemGroup, IGMData.Group.Base.Create(Statuses.Create(), IGMData.Pool.Item.Create(), TargetPool.Create()))
            };

            Memory.ProcessActions(actions);
            ChoiceChangeHandler         = help.TextChangeEvent;
            ItemPool.ItemChangeHandler += help.TextChangeEvent;
            ModeChangeHandler          += help.ModeChangeEvent;
            Func <bool> TopMenuInputs = null;

            if (Data[SectionName.TopMenu] != null)
            {
                TopMenuInputs = Data[SectionName.TopMenu].Inputs;
            }
            InputsDict = new Dictionary <Mode, Func <bool> >()
            {
                { Mode.TopMenu, TopMenuInputs },
                { Mode.SelectItem, UseItemGroup.ITEM[1, 0].Inputs },
                { Mode.UseItemOnTarget, UseItemGroup.ITEM[2, 0].Inputs }
            };
            SetMode(Mode.SelectItem);
        }