Пример #1
0
    public void Begin()
    {
        gameUi.SetActive(true);
        gameSelectUi.SetActive(false);

        //Init the art work for the hud
        //Init hud elements
        mapBackground.texture = GameWorldController.instance.bytloader.LoadImageAt(BytLoader.BLNKMAP_BYT);
        //mainwindow_art.texture=GameWorldController.instance.bytloader.LoadImageAt(BytLoader.MAIN_BYT);

        CursorIcon        = GameWorldController.instance.grCursors.LoadImageAt(0);
        CursorIconDefault = GameWorldController.instance.grCursors.LoadImageAt(0);
        CursorIconTarget  = GameWorldController.instance.grCursors.LoadImageAt(9);
        MapQuill          = GameWorldController.instance.grCursors.LoadImageAt(14);
        MapQuillWriting   = GameWorldController.instance.grCursors.LoadImageAt(12);
        MapEraser         = GameWorldController.instance.grCursors.LoadImageAt(13);
        //inventoryDownArrow.texture=GameWorldController.instance.grCursors.LoadImageAt(2);
        //inventoryUpArrow.texture=GameWorldController.instance.grCursors.LoadImageAt(1);

        GRLoader grPanels = new GRLoader(GRLoader.PANELS_GR);

        InventoryPanel.GetComponent <RawImage>().texture    = grPanels.LoadImageAt(0);
        RuneBagPanel.GetComponent <RawImage>().texture      = grPanels.LoadImageAt(1);
        StatsDisplayPanel.GetComponent <RawImage>().texture = grPanels.LoadImageAt(2);

        UWHUD.instance.EnableDisableControl(UWHUD.instance.main_windowUW1, _RES != GAME_UW2);
        UWHUD.instance.EnableDisableControl(UWHUD.instance.main_windowUW2, _RES == GAME_UW2);

        UWHUD.instance.EnableDisableControl(UWHUD.instance.InteractionControlUW1.gameObject, _RES != GAME_UW2);
        UWHUD.instance.EnableDisableControl(UWHUD.instance.InteractionControlUW2.gameObject, _RES == GAME_UW2);

        MapPanel.transform.SetAsLastSibling();
        ConversationPanel.transform.SetAsLastSibling();

        GRLoader grButtons = new GRLoader(GRLoader.BUTTONS_GR);

        if (grButtons != null)
        {
            InvUp.GetComponent <RawImage>().texture   = grButtons.LoadImageAt(27);
            InvDown.GetComponent <RawImage>().texture = grButtons.LoadImageAt(28);
        }

        if (_RES == GAME_UW2)
        {//Set line width of message scroll for UW2.
            MessageScroll.LineWidth   = 54;
            Conversation_tl.LineWidth = 48;
        }

        switch (_RES)
        {
        case GAME_UW2:
            //Set UW2 specific UI positions

            SetUIElementPosition(window, 128f, 210f, new Vector2(-40.8f, 20f));

            SetUIElementPosition(HudCompass, 16f, 52f, new Vector2(-40f, -56f));
            SetUIElementPosition(HudCompass.NorthIndicators[0], 4f, 10f, new Vector2(26.02f - 26f, 13.98f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[1], 4f, 10f, new Vector2(33.01f - 26f, 13.99f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[2], 5f, 5f, new Vector2(40.46f - 26f, 12.51f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[3], 4f, 10f, new Vector2(44.00f - 26f, 12.01f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[4], 5f, 7f, new Vector2(48.52f - 26f, 8.5f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[5], 6f, 9f, new Vector2(46.51f - 26f, 7.02f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[6], 5f, 8f, new Vector2(42.00f - 26f, 4.5f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[7], 5f, 11f, new Vector2(33.49f - 26f, 3.5f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[8], 5f, 12f, new Vector2(26f - 26f, 2.49f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[9], 5f, 11f, new Vector2(18.5f - 26f, 3.49f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[10], 5f, 8f, new Vector2(9.99f - 26f, 4.49f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[11], 6f, 10f, new Vector2(5.04f - 26f, 7.01f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[12], 5f, 7f, new Vector2(3.49f - 26f, 8.49f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[13], 5f, 8f, new Vector2(5.98f - 26f, 10.51f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[14], 6f, 8f, new Vector2(11.99f - 26f, 11.97f - 8f));
            SetUIElementPosition(HudCompass.NorthIndicators[15], 5f, 10f, new Vector2(19.03f - 26f, 13.5f - 8f));
            SetUIElementPosition(powergem, 5f, 14f, new Vector2(-40f, -53.79f));
            powergem.transform.parent.GetComponent <RectTransform>().SetSiblingIndex(HudCompass.GetComponent <RectTransform>().GetSiblingIndex() + 1);

            SetUIElementPosition(ChainsControl, 32f, 15f, new Vector2(119.7f, -35f));

            FlaskMana.GetComponent <RectTransform>().anchoredPosition   = new Vector2(139.5f, -48.4f);
            FlaskHealth.GetComponent <RectTransform>().anchoredPosition = new Vector2(100.14f, -48.5f);

            activeRunes[0].transform.parent.GetComponent <RectTransform>().anchoredPosition = new Vector2(1.9f, -11.6f);

            spelleffectdisplay[0].transform.parent.GetComponent <RectTransform>().anchoredPosition = new Vector2(-35f, -11.6f);

            //InventoryPanel.GetComponent<RectTransform>().anchoredPosition = new Vector2(114.7f,36f);
            SetUIElementPosition(InventoryPanel, 112f, 79f, new Vector2(114.6f, 36.7f));
            SetUIElementPosition(RuneBagPanel, 112f, 79f, new Vector2(114.6f, 36.7f));
            SetUIElementPosition(StatsDisplayPanel, 112f, 79f, new Vector2(114.6f, 36.7f));
            //RuneBagPanel.GetComponent<RectTransform>().anchoredPosition = new Vector2(114.7f,36f);
            //StatsDisplayPanel.GetComponent<RectTransform>().anchoredPosition = new Vector2(114.7f,36f);

            SetUIElementPosition(playerBody, 69f, 36f, new Vector2(1.78f, 20.51f));


            SetUIElementPosition(RightShoulder_Slot, 16f, 16f, new Vector2(16.8f - 39f, 99.4f - 56.3f));
            SetUIElementPosition(LeftShoulder_Slot, 16f, 16f, new Vector2(65.3f - 39f, 99.4f - 56.3f));
            SetUIElementPosition(RightHand_Slot, 16f, 16f, new Vector2(12.8f - 39f, 77f - 56.3f));
            SetUIElementPosition(LeftHand_Slot, 16f, 16f, new Vector2(68.3f - 39f, 76.9f - 56.3f));

            SetUIElementPosition(BackPack_Slot[0], 16f, 16f, new Vector2(11.9f - 39f, 30f - 55.9f));
            SetUIElementPosition(BackPack_Slot[1], 16f, 16f, new Vector2(30.9f - 39f, 30f - 55.9f));
            SetUIElementPosition(BackPack_Slot[2], 16f, 16f, new Vector2(49.9f - 39f, 30f - 55.9f));
            SetUIElementPosition(BackPack_Slot[3], 16f, 16f, new Vector2(68.9f - 39f, 30f - 55.9f));
            SetUIElementPosition(BackPack_Slot[4], 16f, 16f, new Vector2(11.9f - 39f, 12f - 55.9f));
            SetUIElementPosition(BackPack_Slot[5], 16f, 16f, new Vector2(30.9f - 39f, 12f - 55.9f));
            SetUIElementPosition(BackPack_Slot[6], 16f, 16f, new Vector2(49.9f - 39f, 12f - 55.9f));
            SetUIElementPosition(BackPack_Slot[7], 16f, 16f, new Vector2(68.9f - 39f, 12f - 55.9f));

            SetUIElementPosition(ContainerOpened, 16f, 16f, new Vector2(-26f, -4.8f));

            SetUIElementPosition(RightRing_Slot, 8f, 8f, new Vector2(-13.71f, 5.01f));
            SetUIElementPosition(LeftRing_Slot, 8f, 8f, new Vector2(17.69f, 5.01f));

            SetUIElementPosition(MonsterEyes, 3f, 20f, new Vector2(-40.06f, 94.48f));

            SetUIElementPosition(Legs_f_Slot, 51f, 19f, new Vector2(276.83f - 157.83f, 132.71f - 80.71f));
            SetUIElementPosition(Chest_f_Slot, 44f, 33f, new Vector2(277.83f - 157.83f, 137.71f - 80.71f));
            SetUIElementPosition(Helm_f_Slot, 20f, 20f, new Vector2(276.38f - 157.83f, 162.74f - 80.71f));
            SetUIElementPosition(Gloves_f_Slot, 15f, 33f, new Vector2(276.9f - 157.83f, 131.11f - 80.71f));
            SetUIElementPosition(Boots_f_Slot, 14f, 21f, new Vector2(275.83f - 157.83f, 109.01f - 80.71f));

            SetUIElementPosition(Legs_m_Slot, 51f, 19f, new Vector2(276.83f - 157.83f, 132.71f - 80.71f));
            SetUIElementPosition(Chest_m_Slot, 44f, 33f, new Vector2(277.83f - 157.83f, 137.71f - 80.71f));
            SetUIElementPosition(Helm_m_Slot, 20f, 20f, new Vector2(276.38f - 157.83f, 162.74f - 80.71f));
            SetUIElementPosition(Gloves_m_Slot, 15f, 33f, new Vector2(276.9f - 157.83f, 131.11f - 80.71f));
            SetUIElementPosition(Boots_m_Slot, 14f, 21f, new Vector2(275.83f - 157.83f, 109.01f - 80.71f));


            SetUIElementPosition(ContainerOpened.GetComponent <ContainerOpened>().BackpackBg, 0.9f, -34.4f, new Vector2(40.9f, 21.7f));

            MessageLogScrollEdgeRight.GetComponent <RectTransform>().anchoredPosition = new Vector2(65.87f, -64.4f);
            MessageScrollBackground.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 208.68f);
            MessageScrollBackground.GetComponent <RectTransform>().anchoredPosition = new Vector2(-40.8f, -64.8f);
            MessageScrollDrag.GetComponent <RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 216f);
            MessageScrollDrag.GetComponent <RectTransform>().anchoredPosition = new Vector2(-41.2f, -64.5f);

            //MessageScroll.GetComponent<RectTransform>().SetSizeWithCurrentAnchors(RectTransform.Axis.Horizontal, 172f);
            //MessageScroll.GetComponent<RectTransform>().anchoredPosition= new Vector2(-39.5f, -62.4f);
            SetUIElementPosition(MessageScroll, 33f, 174f, new Vector2(-40.93f, -62.4f));

            //Conversation element positions
            SetUIElementPosition(Conversation_tl, 80f, 198f, new Vector2(-38.54f, -19.9f));
            SetUIElementPosition(ConversationPortraits[0], 70f, 64f, new Vector2(39.9f, 62f));
            SetUIElementPosition(ConversationPortraits[1], 70f, 64f, new Vector2(-125.9f, 62f));
            PCName.GetComponent <RectTransform>().anchoredPosition = new Vector2(-37.6f, 97.871f);
            PCName.alignment = TextAnchor.MiddleRight;
            NPCName.GetComponent <RectTransform>().anchoredPosition = new Vector2(-46.7f, 29.9f);
            NPCName.alignment = TextAnchor.MiddleLeft;


            //Player Trade

            SetUIElementPosition(playerTrade[0], 16f, 16f, new Vector2(130.7f - 158.6f, 180.8f - 100.69f));
            SetUIElementPosition(playerTrade[1], 16f, 16f, new Vector2(151.2f - 158.6f, 180.8f - 100.69f));
            SetUIElementPosition(playerTrade[2], 16f, 16f, new Vector2(130.7f - 158.6f, 163.2f - 100.69f));
            SetUIElementPosition(playerTrade[3], 16f, 16f, new Vector2(151.2f - 158.6f, 163.2f - 100.69f));
            SetUIElementPosition(playerTrade[4], 16f, 16f, new Vector2(130.7f - 158.6f, 145.62f - 100.69f));
            SetUIElementPosition(playerTrade[5], 16f, 16f, new Vector2(151.2f - 158.6f, 145.6f - 100.69f));

            SetUIElementPosition(npcTrade[0], 16f, 16f, new Vector2(81.5f - 158.6f, 180.8f - 100.69f));
            SetUIElementPosition(npcTrade[1], 16f, 16f, new Vector2(102f - 158.6f, 180.8f - 100.69f));
            SetUIElementPosition(npcTrade[2], 16f, 16f, new Vector2(81.5f - 158.6f, 163.2f - 100.69f));
            SetUIElementPosition(npcTrade[3], 16f, 16f, new Vector2(102f - 158.6f, 163.2f - 100.69f));
            SetUIElementPosition(npcTrade[4], 16f, 16f, new Vector2(81.5f - 158.6f, 145.6f - 100.69f));
            SetUIElementPosition(npcTrade[5], 16f, 16f, new Vector2(102.2f - 158.6f, 145.6f - 100.69f));


            //Automap
            SetUIElementPosition(MapDown, 30f, 30f, new Vector2(145f, 85f));
            SetUIElementPosition(MapUp, 30f, 30f, new Vector2(145f, -85f));
            SetUIElementPosition(MapEraserButton, 30f, 30f, new Vector2(120f, -25f));
            SetUIElementPosition(MapClose, 30f, 60f, new Vector2(120f, -55f));

            MapInteraction.InitMapButtons(InWorldGemSelect);
            break;
        }
    }