コード例 #1
0
ファイル: PhxMainMenu.cs プロジェクト: Ben1138/SWBF2Phoenix
    void AddMap()
    {
        if (LstMaps.CurrentSelection < 0)
        {
            return;
        }

        string mapluafile = MapLuaFiles[LstMaps.CurrentSelection];

        int[] modeIndices = LstModes.GetCheckedIndices();
        int[] eraIndices  = LstEras.GetCheckedIndices();

        for (int i = 0; i < modeIndices.Length; ++i)
        {
            SubIcon modeSub = ModeSubs[modeIndices[i]];

            for (int j = 0; j < eraIndices.Length; j++)
            {
                SubIcon eraSub = EraSubs[eraIndices[j]];

                string         mapName = ENV.GetLocalizedMapName(mapluafile);
                PhxListBoxItem item    = LstRotation.AddItem(mapName);
                item.SetIcon(modeSub.Icon);
                item.SetIcon2(eraSub.Icon);

                string mapScript = SWBFHelpers.Format(mapluafile, eraSub.Sub, modeSub.Sub);
                RotationLuaFiles.Add(mapScript);
            }
        }
    }
コード例 #2
0
ファイル: PhxMainMenu.cs プロジェクト: Ben1138/SWBF2Phoenix
    void Start()
    {
        Debug.Assert(LstMaps != null);
        Debug.Assert(LstModes != null);
        Debug.Assert(LstEras != null);
        Debug.Assert(LstRotation != null);
        Debug.Assert(BtnAdd != null);
        Debug.Assert(BtnRemove != null);
        Debug.Assert(BtnRemoveAll != null);
        Debug.Assert(BtnStart != null);
        Debug.Assert(BtnQuit != null);

        LstMaps.OnSelect += OnMapSelectionChanged;

        BtnAdd.onClick.AddListener(AddMap);
        BtnRemove.onClick.AddListener(RemoveSelectionFromRotation);
        BtnRemoveAll.onClick.AddListener(ClearRotation);
        BtnStart.onClick.AddListener(StartRotation);
        BtnQuit.onClick.AddListener(Quit);

        bool bForMP = false;

        RT.CallLuaFunction("missionlist_ExpandMaplist", 0, bForMP);
        PhxLuaRuntime.Table spMissions = RT.GetTable("missionselect_listbox_contents");

        foreach (KeyValuePair <object, object> entry in spMissions)
        {
            PhxLuaRuntime.Table map = entry.Value as PhxLuaRuntime.Table;
            string mapluafile       = map.Get <string>("mapluafile");
            bool   bIsModLevel      = map.Get <bool>("isModLevel");
            string mapName          = ENV.GetLocalizedMapName(mapluafile);

            LstMaps.AddItem(mapName, bIsModLevel);
            MapLuaFiles.Add(mapluafile);
        }
    }