コード例 #1
0
    public WindowUI LoadWindow(int windowId, WindowType windowType, string title = "", bool combineEnabled = false,
                               bool closeEnabled = false, bool backEnabled = false, bool nextEnabled = false, bool okEnabled = false,
                               int npcId         = 0, int unknown = 0, int unknown2 = 0)
    {
        if (GetWindowUI(windowId) != null)
        {
            return(null);
        }
        WindowUI windowObject = null;

        switch (windowType)
        {
        case WindowType.OptionsBar:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "OptionsBar");
            break;

        case WindowType.InventoryWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Inventory");
            break;

        case WindowType.SpellsWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Spells");
            break;

        case WindowType.CommandBar:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "CommandBar");
            break;

        case WindowType.BuffBar:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "BuffBar");
            break;

        case WindowType.FpsBar:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "FPS");
            break;

        case WindowType.HealthBar:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "HealthBar");
            break;

        case WindowType.ManaBar:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "ManaBar");
            break;

        case WindowType.SpiritBar:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "SpiritBar");
            break;

        case WindowType.ExperienceBar:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "ExperienceBar");
            break;

        case WindowType.CharacterWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Character");
            break;

        case WindowType.ChatWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Chat");
            break;

        case WindowType.VendorWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Vendor");
            break;

        case WindowType.PartyWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Party");
            break;

        case WindowType.Combine2:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Combine2");
            break;

        case WindowType.Combine4:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Combine4");
            break;

        case WindowType.Combine6:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Combine6");
            break;

        case WindowType.Combine8:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Combine8");
            break;

        case WindowType.Combine10:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Combine10");
            break;

        case WindowType.QuestWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Quest");
            break;

        case WindowType.LargeQuestWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "LargeQuest");
            break;

        case WindowType.TextWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "TextWindow");
            break;

        case WindowType.DiscardButton:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "DiscardButton");
            break;

        case WindowType.LetterWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Letter");
            break;

        case WindowType.TradeWindow:
            windowObject = Resources.Load <WindowUI>("Prefabs" + SLASH + "Trade");
            break;
        }
        if (windowObject != null)
        {
            WindowUI window = Instantiate(windowObject, Vector3.zero, Quaternion.identity);
            window.SetWindowId(windowId);
            window.SetTitle(title);
            window.AddButtons(combineEnabled, closeEnabled, backEnabled, nextEnabled, okEnabled);
            window.SetNPCId(npcId);
            window.SetUnknownId(unknown);
            window.SetUnknown2Id(unknown2);
            window.gameObject.name = windowId.ToString();
            window.gameObject.tag  = "Window";
            window.gameObject.SetActive(false);
            m_state.AddWindowToHierarchy(window);
            m_state.LoadWindow(windowId, windowType, window);
            return(window);
        }
        return(null);
    }