Esempio n. 1
0
    void Act5Background()
    {
        var gameObj = GameObject.Find("BackgroundObject");

        if (gameObj != null)
        {
            DestroyImmediate(gameObj);
        }

        var CharacterCreationGameObject = new GameObject("BackgroundObject");

        CharacterCreationGameObject.transform.position = new Vector3(0, 0, 10);
        CharacterCreationGameObject.transform.parent   = transform;
        CharacterCreationGameObject.AddComponent <SpriteRenderer>().sprite = Sprite.Create(new Texture2D(1, 1), new Rect(0, 0, 1, 1), new Vector2());

        StaticScripts.CreateGameObj("StairsObject", "Backgrounds/Act5/Act5_foreground_0005_Layer-6", new Vector3(0.95f, 0.95f), new Vector3(-9.9f, -7.7f, 20f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("FloorObject", "Backgrounds/Act5/Act5_foreground_0004_Layer-5", new Vector3(0.87f, 0.87f), new Vector3(-9f, -2.35f, 30f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("GatesObject", "Backgrounds/Act5/Act5_bridge_0000_Layer-1", new Vector3(0.76f, 0.76f), new Vector3(-8f, -1.65f, 35f), child: true, parentName: "BackgroundObject");

        StaticScripts.CreateGameObj("House1", "Backgrounds/Act5/Act5_foreground_0002_Layer-3", new Vector3(0.6f, 0.6f), new Vector3(-5.7f, 1.4f, 45f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("House2", "Backgrounds/Act5/Act5_buildings_0000_Layer-1", new Vector3(0.65f, 0.65f), new Vector3(-2.3f, -1f, 40f), child: true, parentName: "BackgroundObject");

        StaticScripts.CreateGameObj("House3", "Backgrounds/Act5/Act5_buildings_0004_Layer-5", new Vector3(0.75f, 0.75f), new Vector3(2.35f, 0.73f, 45f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("House4", "Backgrounds/Act5/Act5_buildings_0002_Layer-3", new Vector3(0.6f, 0.6f), new Vector3(2.3f, 1f, 50f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("House5", "Backgrounds/Act5/Act5_buildings_0005_Layer-6", new Vector3(0.75f, 0.75f), new Vector3(-3.25f, -0.05f, 40f), child: true, parentName: "BackgroundObject");

        StaticScripts.CreateGameObj("Statue1", "Backgrounds/Act5/Act5_foreground_0000_Layer-1", new Vector3(0.8f, 0.8f), new Vector3(-9.8f, -2f, 25f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("Statue2", "Backgrounds/Act5/Act5_foreground_0001_Layer-2", new Vector3(0.75f, 0.75f), new Vector3(6.15f, -1.2f, 25f), child: true, parentName: "BackgroundObject");
    }
Esempio n. 2
0
    void InGame()
    {
        if (currentStateObject != null)
        {
            currentStateObject.SetActive(false);
        }

        var InGameObject = SceneGameObject.transform.FindChild("InGameSceneObject") != null?SceneGameObject.transform.FindChild("InGameSceneObject").gameObject : null;

        if (InGameObject != null)
        {
            InGameObject.SetActive(true);
        }
        else
        {
            InGameObject = new GameObject("InGameSceneObject");
            InGameObject.transform.position = new Vector3(0, 0, 10);
            InGameObject.transform.parent   = SceneGameObject.transform;

            var enemyBorder = StaticScripts.CreateGameObj("enemyBorder",
                                                          "Borders/InGame/BattleNetModalNotifications_MediumDialog", new Vector3(1f, 1f), new Vector3(-7.5f, -2.75f, 10f), true, 1, true, typeof(EnemyScript), true, "InGameSceneObject");

            StaticScripts.CreateGameObj("paragonBorder", "Borders/InGame/SkillsPane_Paragon_Base", new Vector3(0.75f, 0.9f), new Vector3(0.15f, -4.5f, 10f), child: true, parentName: "InGameSceneObject");

            var bannerWindowObject = new GameObject("BannerWindowGameObject");
            bannerWindowObject.transform.parent = InGameObject.transform;
            bannerWindowObject.AddComponent <BannerWindowScript>();
        }
        currentStateObject = InGameObject;

        Act1Background();
    }
    void Start()
    {
        Account.CurrentAccount.GetCurrentHero().InventoryClass.InventoryChangedEvent += DrawInventory;

        var currencyBackground = StaticScripts.CreateGameObj("CurrencyBackgroundObject",
                                                             "Borders/InGame/Inventory/BattleNetAuctionHouse_AccountBalanceBg", new Vector3(1.1f, 1.1f),
                                                             new Vector3(2.5f, -3.8f, 0f), child: true, parentName: name);

        StaticScripts.CreateGameObj("CoinIcon", "Borders/InGame/Inventory/gold", new Vector3(0.9f, 0.9f),
                                    new Vector3(0.25f, 0.08f, 0f), child: true, parentName: currencyBackground.name);

        StaticScripts.CreateGameObj("ShardsIcon", "Borders/InGame/Inventory/x1_shard", new Vector3(0.9f, 0.9f),
                                    new Vector3(2.5f, 0.08f, 0f), child: true, parentName: currencyBackground.name);

        goldAmountTextObject = StaticScripts.CreateTextObj("GoldAmountTextObject",
                                                           Account.CurrentAccount.GetCurrentHero().Heroic
                    ? Account.CurrentAccount.GoldHardcore.ToString()
                    : Account.CurrentAccount.Gold.ToString(),
                                                           new Vector3(0.02f, 0.02f), new Vector3(0.65f, 0.35f), FontType.StandartFont, 110, Color.white,
                                                           TextAlignment.Center,
                                                           true, currencyBackground.name);

        shardsAmountTextObject = StaticScripts.CreateTextObj("ShardsAmountTextObject",
                                                             Account.CurrentAccount.GetCurrentHero().Heroic
                    ? Account.CurrentAccount.BloodShardsHardcore.ToString()
                    : Account.CurrentAccount.BloodShards.ToString(),
                                                             new Vector3(0.02f, 0.02f), new Vector3(2.9f, 0.35f), FontType.StandartFont, 110, Color.white,
                                                             TextAlignment.Center,
                                                             true, currencyBackground.name);
    }
Esempio n. 4
0
    void Start()
    {
        maxHP     = Convert.ToInt32(Math.Pow(10, Math.Sqrt(Account.CurrentAccount.GetCurrentHero().Level)));
        currentHP = maxHP;

        var textObj = StaticScripts.CreateTextObj("EnemyNameText", enemyName, new Vector3(0.02f, 0.02f), new Vector3(0f, 0f, 0f),
                                                  FontType.DiabloFont, 120, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "enemyBorder", FontStyle.Bold);

        textObj.transform.localPosition = new Vector3(2.5f - (textObj.GetComponent <Renderer>().bounds.size.x / 4f), 5.3f);

        StaticScripts.CreateGameObj("EnemyHpBar", "Borders/InGame/EnemyHPbar01_Base",
                                    new Vector3(2.1f, 2f), new Vector3(0.2f, 0.25f, 10f), child: true, parentName: "enemyBorder");

        var hpMeterObject = StaticScripts.CreateGameObj("EnemyHpMeter", "Borders/InGame/EnemyHPbar01_Meter_Full",
                                                        new Vector3(2.1f, 2f), new Vector3(-6.7f, -2.165f, 160f), child: true, parentName: "InGameSceneObject");

        hpMeterObject.GetComponent <SpriteRenderer>().sortingOrder = 3;

        hpTextObject = StaticScripts.CreateTextObj("enemyHpText", currentHP.ToString(), new Vector3(0.02f, 0.02f), new Vector3(0f, 0f, 10f),
                                                   FontType.DiabloFont, 70, Color.white, TextAlignment.Center, true, "EnemyHpMeter", FontStyle.Bold);
        hpTextObject.transform.localPosition = new Vector3(0.95f - (hpTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 0.165f);
        hpTextObject.transform.localScale    = new Vector3(1f, 1.2f);

        var shader = Shader.Find("Masked/Mask");     //this shader is used to hide that part of the HP which was 'damaged'

        hpMeterDepthMask = new GameObject("HpMeterMaskObject");
        hpMeterDepthMask.AddComponent <SpriteRenderer>().sprite   = Sprite.Create(new Texture2D(1, 1), new Rect(0, 0, 1, 1), new Vector2());
        hpMeterDepthMask.GetComponent <SpriteRenderer>().material = new Material(shader);
        hpMeterDepthMask.transform.position   = new Vector3(-2.73f, -2.2f, 140f);
        hpMeterDepthMask.transform.parent     = GameObject.Find("InGameSceneObject").transform;
        hpMeterDepthMask.transform.localScale = new Vector3(400f, 35f, 1f);

        //Start a timer which will call for a method every 1 second
        InvokeRepeating("ApplyBotDamage", 1f, 1f);
    }
Esempio n. 5
0
    private void OnMouseUpAsButton()
    {
        if (gameObject.GetComponent <SpriteRenderer>().sprite.texture.name ==
            string.Format("BattleNetHeroCreate_Gender{0}Selected", gender))
        {
            return;
        }

        gameObject.GetComponent <SpriteRenderer>().sprite = StaticScripts.CreateSprite(String.Format(@"Icons/CharacterCreation/BattleNetHeroCreate_Gender{0}Selected", gender));


        Account.CurrentAccount.GetCurrentHero().Gender = gender == "Male";
        GameObject.Find("ClassPortrait").GetComponent <SpriteRenderer>().sprite = StaticScripts.CreateSprite(string.Format("Portraits/Heroes/Portrait_{0}_{1}",
                                                                                                                           Account.CurrentAccount.GetCurrentHero().Class,
                                                                                                                           Account.CurrentAccount.GetCurrentHero().Gender
                    ? "Male"
                    : "Female"));

        var obj = GameObject.Find(gender == "Female" ? gameObject.name.Replace("Female", "Male") : gameObject.name.Replace("Male", "Female"));

        if (obj == null)
        {
            return;
        }

        obj.GetComponent <SpriteRenderer>().sprite = StaticScripts.CreateSprite(String.Format(@"Icons/CharacterCreation/BattleNetHeroCreate_Gender{0}Up", gender == "Female" ? "Male" : "Female"));
    }
Esempio n. 6
0
    void Act1Background()
    {
        var gameObj = GameObject.Find("BackgroundObject");

        if (gameObj != null)
        {
            DestroyImmediate(gameObj);
        }

        var CharacterCreationGameObject = new GameObject("BackgroundObject");

        CharacterCreationGameObject.transform.position = new Vector3(0, 0, 10);
        CharacterCreationGameObject.transform.parent   = transform;
        CharacterCreationGameObject.AddComponent <SpriteRenderer>().sprite = Sprite.Create(new Texture2D(1, 1), new Rect(0, 0, 1, 1), new Vector2());

        StaticScripts.CreateGameObj("CharacterCreationBackground", @"Backgrounds/CharacterCreation/Battlenet_MainScreenBackground_flipped", new Vector3(1.1f, 1.1f), new Vector3(-12.1f, -5.5f, 100f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("CharacterCreationTree", @"Backgrounds/CharacterCreation/Battlenet_MainScreenBackground_Alpha_flipped", new Vector3(1.3f, 1.3f), new Vector3(-11.65f, -6.5f, 95f), child: true, parentName: "BackgroundObject");

        #region CharacterPlatform

        StaticScripts.CreateGameObj("platform2", @"Backgrounds/CharacterCreation/CharacterPlatform_0000_Layer-1", new Vector3(1.1f, 0.6f), new Vector3(-2.3f, -5.8f, 60f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("platform1", @"Backgrounds/CharacterCreation/CharacterPlatform_0001_Layer-2", new Vector3(1.15f, 0.9f), new Vector3(-4.88f, -5.45f, 50f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("platform3", @"Backgrounds/CharacterCreation/CharacterPlatform_0004_Layer-5", new Vector3(1.2f, 1.3f), new Vector3(-12.30f, -8.55f, 45f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("platform4", @"Backgrounds/CharacterCreation/CharacterPlatform_0003_Layer-4", new Vector3(0.7f, 0.7f), new Vector3(-4f, -4f, 55f), child: true, parentName: "BackgroundObject");
        StaticScripts.CreateGameObj("platform5", @"Backgrounds/CharacterCreation/CharacterPlatform_0002_Layer-3", new Vector3(1f, 1f), new Vector3(6.57f, -1.65f, 40f), child: true, parentName: "BackgroundObject");

        #endregion
    }
Esempio n. 7
0
    void UpdateAmountOfSlotsAndCreateHeroButton()
    {
        var remainingSlotsText = gameObject.transform.FindChild("HeroSlotRemainingText");

        if (!remainingSlotsText)
        {
            StaticScripts.CreateTextObj("HeroSlotRemainingText", string.Format("{0} Hero Slots Remaining", 12 - Account.CurrentAccount.ListOfHeroes.Count),
                                        new Vector3(0.02f, 0.02f), new Vector3(-7.4f, -3.15f, 0f), FontType.StandartFont, 65, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "CharacterSelectionSceneObject");
        }
        else
        {
            remainingSlotsText.gameObject.GetComponent <TextMesh>().text = string.Format("{0} Hero Slots Remaining", 12 - Account.CurrentAccount.ListOfHeroes.Count);
        }


        var createNewHeroButton = gameObject.transform.FindChild("CreateHeroButton");

        if (!createNewHeroButton)
        {
            StaticScripts.CreateGameObj("CreateHeroButton", @"Buttons/BattleNetButton_RedUp_397x66", new Vector3(0.85f, 0.85f), new Vector3(-8.2f, -3f, 10f), true, 1, true,
                                        typeof(ButtonBaseMouseEvents), child: true, parentName: "CharacterSelectionSceneObject");
            createNewHeroButton = gameObject.transform.FindChild("CreateHeroButton");
            createNewHeroButton.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate { GameObject.Find("MainLogic").GetComponent <Main>().CurrentGameState = GameState.CharacterCreation; };
            StaticScripts.CreateTextObj("CreateHeroButtonText", "Create", new Vector3(0.02f, 0.02f), new Vector3(1.6f, 0.4f, 0f), FontType.DiabloFont, 90, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "CreateHeroButton");
        }
        createNewHeroButton.GetComponent <ButtonBaseMouseEvents>()._State = Account.CurrentAccount.ListOfHeroes.Count == 12 ? ButtonState.Disabled : ButtonState.Up;

        UpdateCurrentHeroPortrait();
    }
Esempio n. 8
0
    void OnMouseDown()
    {
        if (gameObject.GetComponent <SpriteRenderer>().sprite.texture.name == string.Format("BattleNetHeroCreate_Gender{0}Selected", gender))
        {
            return;
        }

        gameObject.GetComponent <SpriteRenderer>().sprite = StaticScripts.CreateSprite(String.Format(@"Icons/CharacterCreation/BattleNetHeroCreate_Gender{0}Down", gender));
    }
Esempio n. 9
0
    public void SetRepresentedTab(CurrentTab tab)
    {
        _representedTab = tab;
        text            = tab.ToString();
        var textObj = StaticScripts.CreateTextObj(name + "_text", text, new Vector3(0.02f, 0.02f), new Vector3(0f, 0f, 0f),
                                                  FontType.DiabloFont, 96, new Color32(131, 176, 209, 255), TextAlignment.Center, true, name, FontStyle.Bold);

        textObj.transform.localPosition = text.Length > 8 ? new Vector3(0.9f, 0.5f, 0f) : new Vector3(0.9f, 1.1f - (textObj.GetComponent <Renderer>().bounds.size.x / 2f), 0f);
        textObj.transform.localScale    = new Vector2(1f, 1.5f);
    }
Esempio n. 10
0
    void ShowTopAndBottomBorders()
    {
        StaticScripts.CreateGameObj("footer", @"Backgrounds/CharacterCreation/BattleNetFooter_BG_4x3", new Vector3(1f, 0.5f), new Vector3(-10.24f, -5f, 10f), child: true, parentName: "MainLogic", sortingOrder: 7);
        StaticScripts.CreateGameObj("footerRight", @"Backgrounds/CharacterCreation/BattleNetFooter_BG_EndCapRight", new Vector3(1f, 0.5f), new Vector3(10.24f, -5f, 10f), child: true, parentName: "MainLogic", sortingOrder: 7);
        StaticScripts.CreateGameObj("footerLeft", @"Backgrounds/CharacterCreation/BattleNetFooter_BG_EndCapLeft", new Vector3(1f, 0.5f), new Vector3(-12.8f, -5f, 10f), child: true, parentName: "MainLogic", sortingOrder: 7);

        StaticScripts.CreateGameObj("header", @"Backgrounds/CharacterCreation/BattleNetHeader_BG_4x3", new Vector3(0.7f, 1f), new Vector3(-7.168f, 4.36f, 10f), child: true, parentName: "MainLogic", sortingOrder: 7);
        StaticScripts.CreateGameObj("headerLeft", @"Backgrounds/CharacterCreation/BattleNetHeader_BG_EndCapLeft", new Vector3(0.7f, 1f), new Vector3(-8.96f, 4.36f, 10f), child: true, parentName: "MainLogic", sortingOrder: 7);
        StaticScripts.CreateGameObj("headerRight", @"Backgrounds/CharacterCreation/BattleNetHeader_BG_EndCapRight", new Vector3(0.7f, 1f), new Vector3(7.168f, 4.36f, 10f), child: true, parentName: "MainLogic", sortingOrder: 7);
    }
Esempio n. 11
0
    void Start()
    {
        StaticScripts.CreateTextObj("CharacterName", "", new Vector3(0.02f, 0.02f), new Vector3(0.3f, 0.4f, 0f), FontType.StandartFont, 110, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "NameTextBox");
        characterNameGameObject = GameObject.Find("CharacterName");

        StaticScripts.CreateTextObj("characterNameCaret", "|", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(0.2f, 0.45f), FontType.StandartFont, 120, new Color32(243, 170, 85, 255), child: true, parentName: gameObject.name);
        caretGameObject = GameObject.Find("characterNameCaret");
        caretGameObject.GetComponent <Renderer>().enabled = false;
        EnableCaret(new Vector3(characterNameGameObject.transform.localPosition.x, 0.45f));
    }
Esempio n. 12
0
    void LoginMenu()
    {
        if (currentStateObject != null)
        {
            Destroy(currentStateObject);
        }

        Act5Background();

        var LoginGameObject = SceneGameObject.transform.FindChild("LoginSceneObject") != null?SceneGameObject.transform.FindChild("LoginSceneObject").gameObject : null;

        if (LoginGameObject != null)
        {
            LoginGameObject.SetActive(true);
        }
        else
        {
            LoginGameObject = new GameObject("LoginSceneObject");
            LoginGameObject.transform.position = new Vector3(0, 0, 10);
            LoginGameObject.AddComponent <SpriteRenderer>().sprite = Sprite.Create(new Texture2D(1, 1), new Rect(0, 0, 1, 1), new Vector2());
            LoginGameObject.transform.parent = SceneGameObject.transform;

            StaticScripts.CreateGameObj("LoginAndPasswordTextBoxes", @"UI/Login/BattleNetLogin_InputContainer", new Vector3(0.85f, 0.85f), new Vector3(-1.96f, -2.54f, 10f), true, 1, true, typeof(LoginPasswordTextBoxesScript), true, "LoginSceneObject");
            StaticScripts.CreateGameObj("Diablo3Logo", @"Logo/BattleNetLogo_Diablo3_x1", new Vector3(0.82f, 0.85f), new Vector3(-4.69f, -1.13f, 5f), child: true, parentName: "LoginSceneObject");
            StaticScripts.CreateGameObj("RememberMe", @"UI/BattleNetLogin_CheckboxUp", new Vector3(0.85f, 0.85f), new Vector3(-0.98f, -2.195f, 0f), true, 1, true, typeof(CheckBoxMouseEvents), child: true, parentName: "LoginSceneObject");
            StaticScripts.CreateTextObj("AccountNameText", "Account Name", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(-0.972f, 0.17f, 0f), FontType.DiabloFont, 110, new Color32(255, 246, 222, 255), child: true, parentName: "LoginSceneObject");
            StaticScripts.CreateTextObj("PasswordText", "Password", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(-0.635f, -0.92f, 0f), FontType.DiabloFont, 110, new Color32(255, 246, 222, 255), child: true, parentName: "LoginSceneObject");


            StaticScripts.CreateGameObj("ManageAccountsButton", @"Buttons/BattleNetButton_BlueUp_262x50", new Vector3(0.82f, 0.85f), new Vector3(-8.11f, -1.83f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), child: true, parentName: "LoginSceneObject");
            GameObject.Find("ManageAccountsButton").GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
            StaticScripts.CreateTextObj("ManageAccountsButtonText", "Manage Accounts", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(-7.8f, -1.55f, 0f), FontType.DiabloFont, 70, new Color32(243, 170, 85, 255), child: true, parentName: "LoginSceneObject");

            StaticScripts.CreateGameObj("OptionsButton", @"Buttons/BattleNetButton_BlueUp_262x50", new Vector3(0.82f, 0.85f), new Vector3(-8.11f, -2.28f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), child: true, parentName: "LoginSceneObject");
            GameObject.Find("OptionsButton").GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
            StaticScripts.CreateTextObj("OptionsButtonText", "Options", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(-7.37f, -2f, 0f), FontType.DiabloFont, 70, new Color32(243, 170, 85, 255), child: true, parentName: "LoginSceneObject");

            StaticScripts.CreateGameObj("CreditsButton", @"Buttons/BattleNetButton_BlueUp_262x50", new Vector3(0.82f, 0.85f), new Vector3(-8.11f, -2.73f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), child: true, parentName: "LoginSceneObject");
            GameObject.Find("CreditsButton").GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
            StaticScripts.CreateTextObj("CreditsButtonText", "Credits", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(-7.35f, -2.45f, 0f), FontType.DiabloFont, 70, new Color32(243, 170, 85, 255), child: true, parentName: "LoginSceneObject");

            StaticScripts.CreateGameObj("ExitButton", @"Buttons/BattleNetButton_BlueUp_262x50", new Vector3(0.82f, 0.85f), new Vector3(-8.11f, -3.95f, 10f), true, 1, true, typeof(ExitButtonScript), child: true, parentName: "LoginSceneObject");
            StaticScripts.CreateTextObj("ExitButtonText", "Exit", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(-7.25f, -3.67f, 0f), FontType.DiabloFont, 70, new Color32(243, 170, 85, 255), child: true, parentName: "LoginSceneObject");

            StaticScripts.CreateGameObj("LoginButton", @"Buttons/BattleNetButton_RedDisabled_397x66", new Vector3(0.845f, 0.85f), new Vector3(-1.66f, -3.2f, 10f), true, 1, true, typeof(LoginButtonScript), child: true, parentName: "LoginSceneObject");
            GameObject.Find("LoginButton").GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
            StaticScripts.CreateTextObj("LoginButtonText", "Login", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(-0.3f, -2.84f, 0f), FontType.DiabloFont, 96, new Color32(243, 170, 85, 255), child: true, parentName: "LoginSceneObject");

            StaticScripts.CreateGameObj("BreakingNews", @"UI/Login/BattleNetLogin_BreakingNewsBg", new Vector3(0.85f, 0.85f), new Vector3(5.3f, -4f), child: true, parentName: "LoginSceneObject");
            StaticScripts.CreateTextObj("BreakingNewsHeaderText", "Login Help", new Vector3(0.02f, 0.02f), new Vector3(0.95f, 4.15f, 0f), FontType.DiabloFont, 150, new Color32(255, 246, 222, 255), child: true, parentName: "BreakingNews");
            StaticScripts.CreateTextObj("BreakingNewsBodyText", "\tYou can create new account by entering \ndata in \"Account Name\" and \"Password\" fields. \nBe sure that you have at least 6 characters at \n\"Account Name\" field and at least 1 character \nat \"Password\" field.", new Vector3(0.02f, 0.02f), new Vector3(0.2f, 3.2f, 0f), FontType.StandartFont, 80, new Color32(255, 246, 222, 255), child: true, parentName: "BreakingNews");
        }
    }
Esempio n. 13
0
    // Use this for initialization
    void Start()
    {
        StaticScripts.CreateGameObj("DiabloLogo", "Logo/BattleNetLogo_Diablo3_x1", new Vector3(0.6f, 0.6f), new Vector3(-10.1f, 1.1f, 10f), sortingOrder: 8, child: true, parentName: "MainMenuSceneObject");
        var startGameButton = StaticScripts.CreateGameObj("StartGameButton", "Buttons/BattleNetButton_RedUp_398x82", new Vector3(0.82f, 0.8f), new Vector3(-8.33f, -0.1f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), sortingOrder: 9, child: true, parentName: "MainMenuSceneObject");

        startGameButton.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
        {
            if (!GameObject.Find("TristramMainObject"))
            {
                Application.LoadLevelAdditive("TristramScene");
                GameObject.Find("MainLogic").SetActive(false);
            }
            else
            {
                GameObject.Find("TristramMainObject").transform.Cast <Transform>()
                .FirstOrDefault(child => child.name == "SceneObjects").gameObject.SetActive(true);

                GameObject.Find("MainLogic").SetActive(false);
            }
        };
        StaticScripts.CreateTextObj("StartGameButtonText", "Start Game", new Vector3(0.02f, 0.02f), new Vector3(1.15f, 0.52f), FontType.DiabloFont, 120, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "StartGameButton");

        var gameSettingsButton = StaticScripts.CreateGameObj("GameSettingsButton", "Buttons/BattleNetButton_ClearUp_260x50", new Vector3(0.95f, 0.65f), new Vector3(-7.95f, -0.55f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), true, "MainMenuSceneObject");

        gameSettingsButton.GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
        StaticScripts.CreateTextObj("GameSettingsButtonText", "Game settings", new Vector3(0.02f, 0.02f), new Vector3(0.65f, 0.4f), FontType.DiabloFont, 75, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "GameSettingsButton");

        var switchHeroButton = StaticScripts.CreateGameObj("SwitchHeroButton", "Buttons/BattleNetButton_RedUp_262x50", new Vector3(0.85f, 0.8f), new Vector3(-1.15f, -3.8f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), true, "MainMenuSceneObject");

        StaticScripts.CreateTextObj("SwitchHeroButtonText", "Switch Hero", new Vector3(0.02f, 0.02f), new Vector3(0.78f, 0.31f), FontType.DiabloFont, 70, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "SwitchHeroButton");
        switchHeroButton.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate { GameObject.Find("MainLogic").GetComponent <Main>().CurrentGameState = GameState.CharacterSelection; };

        var profileButton = StaticScripts.CreateGameObj("ProfileButton", "Buttons/BattleNetButton_ClearUp_74x66", new Vector3(0.85f, 0.85f), new Vector3(6.15f, -4.65f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), true, "MainMenuSceneObject");

        profileButton.GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
        StaticScripts.CreateGameObj("ProfileButtonIcon", "Icons/BattleNetFooter_ProfileButtonIcon", new Vector3(1f, 1f), new Vector3(0.23f, 0.15f, 10f), child: true, parentName: "ProfileButton");

        var leaderboardButton = StaticScripts.CreateGameObj("LeaderboardButton", "Buttons/BattleNetButton_ClearUp_74x66", new Vector3(0.85f, 0.85f), new Vector3(6.8f, -4.65f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), true, "MainMenuSceneObject");

        leaderboardButton.GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
        StaticScripts.CreateGameObj("LeaderboardButtonIcon", "Icons/BattleNetFooter_LeaderboardButtonIcon", new Vector3(1f, 1f), new Vector3(0.23f, 0.15f, 10f), child: true, parentName: "LeaderboardButton");

        var achievementButton = StaticScripts.CreateGameObj("AchievementsButton", "Buttons/BattleNetButton_ClearUp_74x66", new Vector3(0.85f, 0.85f), new Vector3(7.45f, -4.65f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), true, "MainMenuSceneObject");

        achievementButton.GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
        StaticScripts.CreateGameObj("AchievementsButtonIcon", "Icons/BattleNetFooter_AchievementsButtonIcon", new Vector3(1f, 1f), new Vector3(0.26f, 0.18f, 10f), child: true, parentName: "AchievementsButton");

        var optionButton = StaticScripts.CreateGameObj("OptionsButton", "Buttons/BattleNetButton_ClearUp_74x66", new Vector3(0.85f, 0.85f), new Vector3(8.1f, -4.65f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), true, "MainMenuSceneObject");

        optionButton.GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
        StaticScripts.CreateGameObj("OptionsButtonIcon", "Icons/BattleNetFooter_OptionsButtonIcon", new Vector3(1f, 1f), new Vector3(0.23f, 0.15f, 10f), child: true, parentName: "OptionsButton");
    }
Esempio n. 14
0
    void Start()
    {
        AccountName = string.Empty;
        Password    = string.Empty;
        StaticScripts.CreateTextObj("textBoxCaret", "|", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(0f, 0f), FontType.StandartFont, 100, new Color32(243, 170, 85, 255), child: true, parentName: gameObject.name);
        caretGameObject = GameObject.Find("textBoxCaret");
        caretGameObject.GetComponent <Renderer>().enabled = false;

        StaticScripts.CreateTextObj("AccountName", AccountName, new Vector3(0.02f, 0.02f, 0.02f), new Vector3(0.6f, 2.48f), FontType.StandartFont, 80, new Color32(243, 170, 85, 255), child: true, parentName: gameObject.name);
        accountNameGameObject = GameObject.Find("AccountName");

        StaticScripts.CreateTextObj("Password", Password, new Vector3(0.02f, 0.02f, 0.02f), new Vector3(0.6f, 1.2f), FontType.StandartFont, 80, new Color32(243, 170, 85, 255), child: true, parentName: gameObject.name);
        passwordGameObject = GameObject.Find("Password");
        mainCamera         = GameObject.Find("MainCamera").GetComponents <Camera>()[0];
    }
Esempio n. 15
0
    void UpdateCurrentHeroPortrait()
    {
        var classPortraitObject = gameObject.transform.FindChild("ClassPortrait");

        if (!classPortraitObject)
        {
            StaticScripts.CreateGameObj("ClassPortrait", string.Format("Portraits/Heroes/Portrait_{0}_{1}", Account.CurrentAccount.GetCurrentHero().Class,
                                                                       Account.CurrentAccount.GetCurrentHero().Gender ? "Male" : "Female"), new Vector3(1.5f, 1.5f), new Vector3(-1.65f, -1.15f), child: true, parentName: "CharacterSelectionSceneObject");
        }
        else
        {
            classPortraitObject.GetComponent <SpriteRenderer>().sprite = StaticScripts.CreateSprite(string.Format("Portraits/Heroes/Portrait_{0}_{1}",
                                                                                                                  Account.CurrentAccount.GetCurrentHero().Class, Account.CurrentAccount.GetCurrentHero().Gender ? "Male" : "Female"));
        }
    }
Esempio n. 16
0
    void Start()
    {
        Account.CurrentAccount.HeroDeletedEvent += CreateHeroesList;

        for (int i = 0; i < 19; i++)
        {
            StaticScripts.CreateGameObj(string.Format("ScrollBackgroundPiece_{0}", i), @"Controls/ScrollSmallMiddle", new Vector3(0.7f, 0.7f), new Vector3(-5.03f, 2.8f - (0.27f * i), 10f), child: true, parentName: name, sortingOrder: 2);
        }
        var heroListFrame = StaticScripts.CreateGameObj("HeroListFrame", @"Borders/MainMenu/BattlenetHeroSelect_ListFrame", new Vector3(0.83f, 0.83f), new Vector3(-8.27f, -2.35f, 10f), child: true, parentName: name);

        StaticScripts.CreateGameObj("ScrollUp", @"Controls/ScrollSmallUp_Up", new Vector3(0.7f, 0.7f), new Vector3(-5.03f, 3.07f, 10f), true, 1, true, typeof(ButtonScrollUp), true, name, 3);
        StaticScripts.CreateGameObj("ScrollDown", @"Controls/ScrollSmallDown_Up", new Vector3(0.7f, 0.7f), new Vector3(-5.03f, -2.3f, 10f), true, 1, true, typeof(ButtonScrollDown), true, name, 3);
        StaticScripts.CreateGameObj("Scrollbar", @"Controls/ScrollbarThumb_Up", new Vector3(0.9f, 0.9f), new Vector3(-5f, 2.75f, 10f), true, 1, true, typeof(ScrollBarScript), true, name, 3);

        isInitialized = true;
        CreateHeroesList();
    }
    void LoadHeroesButtons()
    {
        selectedClass = (GameClasses)Enum.GetValues(typeof(GameClasses)).GetValue(Random.Range(0, 6));

        Account.CurrentAccount.AddNewHero(new Hero()
        {
            Class = selectedClass, Gender = true, State = HeroState.NotCreated
        });
        Account.CurrentAccount.SetCurrentHero(Account.CurrentAccount.ListOfHeroes.Count - 1);
        #region ClassButtons

        var classesArray = new[] { "Barbarian", "Crusader", "Demon Hunter", "Monk", "Witch Doctor", "Wizard" };
        for (int i = 0; i < classesArray.Length; i++)
        {
            if (!gameObject.transform.FindChild(string.Format("{0}Button", classesArray[i])))
            {
                var button = StaticScripts.CreateGameObj(string.Format("{0}Button", classesArray[i]), @"Buttons/BattleNetButton_ClearUp_397x66", new Vector3(0.65f, 0.85f), new Vector3(-8.3f, 1.9f - 0.59f * i, 10f), true, 1, true, typeof(CreateCharacterClassMouseEvents), child: true, parentName: "CharacterCreationSceneObject");
                button.GetComponent <ButtonBaseMouseEvents>()._State = selectedClass.ToString() == classesArray[i].Replace(" ", string.Empty) ? ButtonState.Selected : ButtonState.Up;

                var text = StaticScripts.CreateTextObj(string.Format("{0}ButtonText", classesArray[i]), classesArray[i], new Vector3(0.02f, 0.02f), new Vector3(0f, 0f, 0f), FontType.DiabloFont, 100, new Color32(243, 170, 85, 255), TextAlignment.Center, child: true, parentName: string.Format("{0}Button", classesArray[i]), style: FontStyle.Bold);
                text.transform.position = new Vector3((button.transform.position.x + (button.GetComponent <SpriteRenderer>().bounds.size.x / 2f)) - (text.GetComponent <TextMesh>().GetComponent <Renderer>().bounds.size.x / 2f), (button.transform.position.y + (button.GetComponent <SpriteRenderer>().bounds.size.y / 2f)) + (text.GetComponent <TextMesh>().GetComponent <Renderer>().bounds.size.y / 2f));

                if (classesArray[i].Replace(" ", string.Empty) == selectedClass.ToString())
                {
                    StaticScripts.CreateGameObj("ClassPortrait", string.Format("Portraits/Heroes/Portrait_{0}_{1}", classesArray[i].Replace(" ", ""), Account.CurrentAccount.GetCurrentHero().Gender ? "Male" : "Female"), new Vector3(1.5f, 1.5f), new Vector3(-1.65f, -1.15f), child: true, parentName: "CharacterCreationSceneObject");
                }
            }
            else
            {
                var button = GameObject.Find(string.Format("{0}Button", classesArray[i]));
                button.GetComponent <ButtonBaseMouseEvents>()._State = selectedClass.ToString() == classesArray[i].Replace(" ", string.Empty) ? ButtonState.Selected : ButtonState.Up;

                if (classesArray[i].Replace(" ", string.Empty) == selectedClass.ToString())
                {
                    var portraitObject = gameObject.transform.FindChild("ClassPortrait");
                    if (portraitObject)
                    {
                        DestroyImmediate(portraitObject.gameObject);
                    }
                    StaticScripts.CreateGameObj("ClassPortrait", string.Format("Portraits/Heroes/Portrait_{0}_{1}", classesArray[i].Replace(" ", ""), Account.CurrentAccount.GetCurrentHero().Gender ? "Male" : "Female"), new Vector3(1.5f, 1.5f), new Vector3(-1.65f, -1.15f), child: true, parentName: "CharacterCreationSceneObject");
                }
            }
        }

        #endregion
    }
Esempio n. 18
0
    void Start()
    {
        var tab = CurrentTab.Core;

        for (int i = 0; i < 7; i++)
        {
            var banner = StaticScripts.CreateGameObj(string.Format("Banner_{0}", i), "Borders/InGame/Paragon_BannerInactive", new Vector3(0.7f, 1f),
                                                     new Vector3(-1.3f, 2.2f - (i * 0.95f)), true, 1, true, typeof(BannerTabScript), true, name);

            banner.transform.rotation = Quaternion.Euler(new Vector3(180f, 0f, 270f));
            banner.GetComponent <BannerTabScript>().SetRepresentedTab(tab);
            if (i == 0)
            {
                banner.GetComponent <BannerTabScript>().SetTabSelected();
            }
            tab = (CurrentTab)((int)tab + 1);
        }
    }
Esempio n. 19
0
    // Use this for initialization
    void Start()
    {
        Account.CurrentAccount.HeroDeletedEvent        += UpdateAmountOfSlotsAndCreateHeroButton;
        Account.CurrentAccount.CurrentHeroChangedEvent += UpdateCurrentHeroPortrait;

        var selectHeroButton = StaticScripts.CreateGameObj("SelectHeroButton", @"Buttons/BattleNetButton_RedUp_397x66", new Vector3(0.85f, 0.85f), new Vector3(-1.7f, -3.9f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), child: true, parentName: "CharacterSelectionSceneObject");

        selectHeroButton.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
        {
            selectionConfirmed = true;
            GameObject.Find("MainLogic").GetComponent <Main>().CurrentGameState = GameState.MainMenu;
        };
        StaticScripts.CreateTextObj("SelectHeroButtonText", "Select Hero", new Vector3(0.02f, 0.02f), new Vector3(1.3f, 0.41f, 0f), FontType.DiabloFont, 90, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "SelectHeroButton");

        var cancelButton = StaticScripts.CreateGameObj("CancelButton", @"Buttons/BattleNetButton_BlueUp_262x50", new Vector3(0.8f, 0.8f), new Vector3(-7.7f, -3.8f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), child: true, parentName: "CharacterSelectionSceneObject");

        cancelButton.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate { GameObject.Find("MainLogic").GetComponent <Main>().CurrentGameState = GameState.MainMenu; };
        StaticScripts.CreateTextObj("CancelButtonText", "Cancel", new Vector3(0.02f, 0.02f), new Vector3(1f, 0.32f, 0f), FontType.DiabloFont, 80, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "CancelButton");

        var deleteHeroButton = StaticScripts.CreateGameObj("DeleteHeroButton", @"Buttons/BattleNetButton_BlueUp_262x50", new Vector3(0.8f, 0.8f), new Vector3(5.75f, -3.8f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), child: true, parentName: "CharacterSelectionSceneObject");

        deleteHeroButton.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
        {
            if (Account.CurrentAccount.CurrentHeroId == -1)
            {
                return;
            }
            Account.CurrentAccount.DeleteHero(Account.CurrentAccount.GetCurrentHero());

            if (Account.CurrentAccount.CurrentHeroId == -1)
            {
                GameObject.Find("MainLogic").GetComponent <Main>().CurrentGameState = GameState.CharacterCreation;
            }
        };
        StaticScripts.CreateTextObj("DeleteHeroButtonText", "Delete", new Vector3(0.02f, 0.02f), new Vector3(1f, 0.32f, 0f), FontType.DiabloFont, 80, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "DeleteHeroButton");

        StaticScripts.CreateGameObj("SelectHeroHeaderBorder", @"Borders/CharacterCreation/BattlenetHeroCreate_Header", new Vector3(1.15f, 1.15f), new Vector3(-8.1f, 3.5f, 10f), child: true, parentName: "CharacterSelectionSceneObject");
        StaticScripts.CreateTextObj("SelectHeroHeaderBorderText", "Select a Hero", new Vector3(0.02f, 0.02f), new Vector3(0.45f, 0.43f, 0f), FontType.DiabloFont, 100, new Color32(255, 246, 222, 255), TextAlignment.Center, true, "SelectHeroHeaderBorder");
    }
Esempio n. 20
0
    void CreateHeroesList()
    {
        if (!isInitialized)
        {
            return;
        }

        var mainGameObject = GameObject.Find("MainLogic");

        if (mainGameObject == null ||
            mainGameObject.GetComponent <Main>().CurrentGameState != GameState.CharacterSelection)
        {
            return;
        }

        var ParentHeroSlotsObject = GameObject.Find("ParentHeroSlotsObject");

        if (ParentHeroSlotsObject != null)
        {
            DestroyImmediate(ParentHeroSlotsObject);
        }
        ParentHeroSlotsObject = new GameObject("ParentHeroSlotsObject");
        ParentHeroSlotsObject.transform.parent = transform;

        var Scrollbar = GameObject.Find("Scrollbar");

        if (Scrollbar != null && Scrollbar.transform.position != new Vector3(-5f, 2.75f, 10f))
        {
            Scrollbar.transform.position = new Vector3(-5f, 2.75f, 10f);
        }

        var shader = Shader.Find("GUI/3D Text Shader - Cull Back");

        var heightForSelectedChampion = 0f;

        for (int i = 0; i < 12; i++)
        {
            if (i < Account.CurrentAccount.ListOfHeroes.Count)
            {
                var heroSlot = StaticScripts.CreateGameObj(string.Format("HeroSlot_{0}", i), @"Buttons/BattleNetButton_MainMenu_Up", new Vector3(0.83f, 0.83f), new Vector3(-8.24f, 2.6f - (0.8f * i), 150f), true, 1, true, typeof(HeroSlotScript), child: true, parentName: "ParentHeroSlotsObject", sortingOrder: 3);
                heroSlot.GetComponent <HeroSlotScript>().CharacterId = i;
                if (Account.CurrentAccount.CurrentHeroId == i)
                {
                    heroSlot.GetComponent <HeroSlotScript>()._State = ButtonState.Selected;
                    heightForSelectedChampion = 2.15f - (0.8f * i);
                }
                StaticScripts.CreateGameObj(string.Format("HeroSlot_{0}_portrait_background", i), @"Portraits/Heroes/ParagonBorders/Prestige_PortraitCircle_01", new Vector3(1f, 1f), new Vector3(-8.35f, 2.15f - (0.8f * i), 160f), child: true, parentName: "ParentHeroSlotsObject", sortingOrder: 3);

                string pathToTexture = string.Empty;
                switch (Account.CurrentAccount.ListOfHeroes[i].Class)
                {
                case GameClasses.Barbarian:
                    pathToTexture = Account.CurrentAccount.ListOfHeroes[i].Gender ? @"Portraits/Heroes/Portrait_Barbarian_Male" : @"Portraits/Heroes/Portrait_Barbarian_Female";
                    break;

                case GameClasses.Crusader:
                    pathToTexture = Account.CurrentAccount.ListOfHeroes[i].Gender ? @"Portraits/Heroes/Portrait_Crusader_Male" : @"Portraits/Heroes/Portrait_Crusader_Female";
                    break;

                case GameClasses.DemonHunter:
                    pathToTexture = Account.CurrentAccount.ListOfHeroes[i].Gender ? @"Portraits/Heroes/Portrait_Demonhunter_Male" : @"Portraits/Heroes/Portrait_Demonhunter_Female";
                    break;

                case GameClasses.Monk:
                    pathToTexture = Account.CurrentAccount.ListOfHeroes[i].Gender ? @"Portraits/Heroes/Portrait_Monk_Male" : @"Portraits/Heroes/Portrait_Monk_Female";
                    break;

                case GameClasses.WitchDoctor:
                    pathToTexture = Account.CurrentAccount.ListOfHeroes[i].Gender ? @"Portraits/Heroes/Portrait_Witchdoctor_Male" : @"Portraits/Heroes/Portrait_Witchdoctor_Female";
                    break;

                case GameClasses.Wizard:
                    pathToTexture = Account.CurrentAccount.ListOfHeroes[i].Gender ? @"Portraits/Heroes/Portrait_Wizard_Male" : @"Portraits/Heroes/Portrait_Wizard_Female";
                    break;
                }
                StaticScripts.CreateGameObj(string.Format("HeroSlot_{0}_portrait", i), pathToTexture, new Vector3(0.2f, 0.2f), new Vector3(-8.07f, 2.75f - (0.8f * i), 155f), child: true, parentName: "ParentHeroSlotsObject", sortingOrder: 3);


                StaticScripts.CreateGameObj(string.Format("HeroSlot_{0}_background", i), @"Controls/BattleNetHeroSelect_BaseSlot", new Vector3(0.83f, 0.83f), new Vector3(-8.23f, 2.6f - (0.8f * i), 170f), child: true, parentName: "ParentHeroSlotsObject", sortingOrder: 3);


                var nameTextObject = StaticScripts.CreateTextObj(string.Format("HeroSlot_{0}_name", i), Account.CurrentAccount.ListOfHeroes[i].Name, new Vector3(0.02f, 0.02f), new Vector3(0.9f, 0.75f),
                                                                 FontType.StandartFont, 120, new Color32(243, 170, 85, 255), child: true, parentName: string.Format("HeroSlot_{0}", i));
                nameTextObject.GetComponent <Renderer>().material.shader = shader;

                var levelTextObject = StaticScripts.CreateTextObj(string.Format("HeroSlot_{0}_class_level", i), string.Format("Level {0} {1}", Account.CurrentAccount.ListOfHeroes[i].Level, Account.CurrentAccount.ListOfHeroes[i].Class), new Vector3(0.02f, 0.02f), new Vector3(0.9f, 0.45f),
                                                                  FontType.StandartFont, 80, new Color32(141, 105, 53, 255), child: true, parentName: string.Format("HeroSlot_{0}", i));
                levelTextObject.GetComponent <Renderer>().material.shader = shader;

                if (Account.CurrentAccount.ListOfHeroes[i].Heroic)
                {
                    StaticScripts.CreateGameObj(string.Format("HeroSlot_{0}_HeroicIcon", i), @"Icons/CharacterCreation/BattleNet_HardcoreIcon", new Vector3(0.9f, 0.9f), new Vector3(1.2f + nameTextObject.GetComponent <Renderer>().bounds.size.x, 0.45f), child: true, parentName: string.Format("HeroSlot_{0}", i));
                }

                if (Account.CurrentAccount.CurrentHeroId == i)
                {
                    heroSlot.GetComponent <HeroSlotScript>().SetThisSlotSelected();
                }

                continue;
            }
            StaticScripts.CreateGameObj(string.Format("HeroSlot_{0}", i), @"Controls/BattleNetHeroSelect_EmptySlot", new Vector3(0.83f, 0.83f), new Vector3(-8.24f, 2.6f - (0.8f * i), 150f), child: true, parentName: "ParentHeroSlotsObject", sortingOrder: 3);
        }

        MoveHeroSlots(heightForSelectedChampion, true);
    }
    // Use this for initialization
    void Start()
    {
        var firstStatText = "";

        switch (Account.CurrentAccount.GetCurrentHero().Class)
        {
        case GameClasses.Barbarian:
        case GameClasses.Crusader:
            firstStatText = "Strength";
            break;

        case GameClasses.DemonHunter:
        case GameClasses.Monk:
            firstStatText = "Dexterity";
            break;

        case GameClasses.WitchDoctor:
        case GameClasses.Wizard:
            firstStatText = "Intelligence";
            break;

        default:
            throw new ArgumentOutOfRangeException();
        }
        var arrayOfNames = new[] { firstStatText, "Vitality", "SomePerk-1", "SomePerk-2" };

        for (int i = 0; i < 4; i++)
        {
            StaticScripts.CreateGameObj(string.Format("SkillsPanel_{0}", i), "Borders/InGame/SkillsPane_Paragon_StatBase", new Vector3(0.9f, 0.9f), new Vector3(1.15f, 1.6f - (1f * i), 20f), child: true, parentName: name, sortingOrder: 3);

            StaticScripts.CreateTextObj(string.Format("SkillsPanelText_{0}", i), arrayOfNames[i], new Vector3(0.02f, 0.02f), new Vector3(1.2f, 0.64f), FontType.StandartFont, 100, new Color32(243, 170, 85, 255), TextAlignment.Center, true, string.Format("SkillsPanel_{0}", i));

            var minusButtonObject = StaticScripts.CreateGameObj(string.Format("SkillsPanel_{0}_Minus", i), "Buttons/D3_ListBtn_Collapse_Up", new Vector3(1f, 1f), new Vector3(6.3f, 0.37f), true, 1, true, typeof(ButtonBaseMouseEvents), true, string.Format("SkillsPanel_{0}", i));

            var plusButtonObject = StaticScripts.CreateGameObj(string.Format("SkillsPanel_{0}_Plus", i), "Buttons/D3_ListBtn_Expand_Up", new Vector3(1f, 1f), new Vector3(7.2f, 0.37f), true, 1, true, typeof(ButtonBaseMouseEvents), true, string.Format("SkillsPanel_{0}", i));

            var spentPointsBonusText = StaticScripts.CreateTextObj(string.Format("SkillsPanel_{0}_SpentPointsBonus", i), "0", new Vector3(0.02f, 0.02f), new Vector3(3.8f, 0.65f), FontType.StandartFont, 130, Color.white, TextAlignment.Center, true, string.Format("SkillsPanel_{0}", i), FontStyle.Bold);

            var spentPointsText = StaticScripts.CreateTextObj(string.Format("SkillsPanel_{0}_SpentPoints", i), "0", new Vector3(0.02f, 0.02f), new Vector3(0f, 0f), FontType.StandartFont, 120, Color.white, TextAlignment.Center, true, string.Format("SkillsPanel_{0}", i), FontStyle.Bold);
            spentPointsText.transform.localPosition = new Vector3(6.85f - (spentPointsText.GetComponent <Renderer>().bounds.size.x / 4f), 0.64f);

            switch (i)
            {
            case 0:
                mainStatPointsTextObject      = spentPointsText;
                mainStatPointsBonusTextObject = spentPointsBonusText;

                plusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().AddTalentPoint(CurrentTab.Core, 1);
                };

                minusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().SubtractTalentPoints(CurrentTab.Core, 1);
                };

                break;

            case 1:
                vitalityPointsTextObject      = spentPointsText;
                vitalityPointsBonusTextObject = spentPointsBonusText;

                plusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().AddTalentPoint(CurrentTab.Core, 2);
                };

                minusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().SubtractTalentPoints(CurrentTab.Core, 2);
                };

                break;

            case 2:
                perkTextPointsObject1      = spentPointsText;
                perkTextPointsBonusObject1 = spentPointsBonusText;

                plusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().AddTalentPoint(CurrentTab.Core, 3);
                };

                minusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().SubtractTalentPoints(CurrentTab.Core, 3);
                };

                break;

            case 3:
                perkTextPointsObject2      = spentPointsText;
                perkTextPointsBonusObject2 = spentPointsBonusText;

                plusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().AddTalentPoint(CurrentTab.Core, 4);
                };

                minusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().SubtractTalentPoints(CurrentTab.Core, 4);
                };

                break;
            }
        }


        unspentPointsTextObject = StaticScripts.CreateTextObj("UnspentPointsTextObject", string.Format("Core Unspent Points: {0}", 0), new Vector3(0.02f, 0.02f), new Vector3(0f, 0f), FontType.StandartFont, 80, new Color32(173, 164, 135, 255), TextAlignment.Center, true, name, FontStyle.Bold);
        unspentPointsTextObject.transform.localPosition = new Vector3(4.6f - (unspentPointsTextObject.GetComponent <Renderer>().bounds.size.x / 2f), -1.5f);
        unspentPointsTextObject.transform.localScale    = new Vector3(1f, 1.1f);

        totalPointsTextObject = StaticScripts.CreateTextObj("PointsTotalTextObject", string.Format("Core Points Total: {0}", 0), new Vector3(0.02f, 0.02f), new Vector3(0f, 0f), FontType.StandartFont, 80, new Color32(173, 164, 135, 255), TextAlignment.Center, true, name, FontStyle.Bold);
        totalPointsTextObject.transform.localPosition = new Vector3(4.6f - (totalPointsTextObject.GetComponent <Renderer>().bounds.size.x / 2f), -1.8f);
        totalPointsTextObject.transform.localScale    = new Vector3(1f, 1.1f);

        var resetButtonGameObject = StaticScripts.CreateGameObj("ResetButton", "Buttons/BattleNetButton_RedUp_262x50", new Vector3(0.8f, 0.9f), new Vector3(3.6f, -2.85f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), true, name);

        resetButtonGameObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate { Account.CurrentAccount.GetCurrentHero().ResetTalentPoints(CurrentTab.Core); };
        StaticScripts.CreateTextObj("ResetButtonText", "Reset", new Vector3(0.02f, 0.02f), new Vector3(0.95f, 0.35f, 0f), FontType.DiabloFont, 100, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "ResetButton");
    }
Esempio n. 22
0
    void UpdateHeroPortraitAndName()
    {
        var classPortraitObject = gameObject.transform.FindChild("ClassPortrait");

        if (!classPortraitObject)
        {
            StaticScripts.CreateGameObj("ClassPortrait", string.Format("Portraits/Heroes/Portrait_{0}_{1}", Account.CurrentAccount.GetCurrentHero().Class,
                                                                       Account.CurrentAccount.GetCurrentHero().Gender ? "Male" : "Female"), new Vector3(1.5f, 1.5f), new Vector3(-1.65f, -1.15f), child: true, parentName: "MainMenuSceneObject");
        }
        else
        {
            classPortraitObject.GetComponent <SpriteRenderer>().sprite = StaticScripts.CreateSprite(string.Format("Portraits/Heroes/Portrait_{0}_{1}",
                                                                                                                  Account.CurrentAccount.GetCurrentHero().Class, Account.CurrentAccount.GetCurrentHero().Gender ? "Male" : "Female"));
        }


        var classSmallPortraitObject = gameObject.transform.FindChild("Hero_portrait");

        if (!classSmallPortraitObject)
        {
            StaticScripts.CreateGameObj("Hero_portrait_background", @"Portraits/Heroes/ParagonBorders/Prestige_PortraitCircle_01", new Vector3(0.9f, 0.9f),
                                        new Vector3(-0.5f, -3.45f, 15f), child: true, parentName: "MainMenuSceneObject");
        }
        string pathToTexture = string.Empty;

        switch (Account.CurrentAccount.GetCurrentHero().Class)
        {
        case GameClasses.Barbarian:
            pathToTexture = Account.CurrentAccount.GetCurrentHero().Gender ? @"Portraits/Heroes/Portrait_Barbarian_Male" : @"Portraits/Heroes/Portrait_Barbarian_Female";
            break;

        case GameClasses.Crusader:
            pathToTexture = Account.CurrentAccount.GetCurrentHero().Gender ? @"Portraits/Heroes/Portrait_Crusader_Male" : @"Portraits/Heroes/Portrait_Crusader_Female";
            break;

        case GameClasses.DemonHunter:
            pathToTexture = Account.CurrentAccount.GetCurrentHero().Gender ? @"Portraits/Heroes/Portrait_Demonhunter_Male" : @"Portraits/Heroes/Portrait_Demonhunter_Female";
            break;

        case GameClasses.Monk:
            pathToTexture = Account.CurrentAccount.GetCurrentHero().Gender ? @"Portraits/Heroes/Portrait_Monk_Male" : @"Portraits/Heroes/Portrait_Monk_Female";
            break;

        case GameClasses.WitchDoctor:
            pathToTexture = Account.CurrentAccount.GetCurrentHero().Gender ? @"Portraits/Heroes/Portrait_Witchdoctor_Male" : @"Portraits/Heroes/Portrait_Witchdoctor_Female";
            break;

        case GameClasses.Wizard:
            pathToTexture = Account.CurrentAccount.GetCurrentHero().Gender ? @"Portraits/Heroes/Portrait_Wizard_Male" : @"Portraits/Heroes/Portrait_Wizard_Female";
            break;
        }
        if (!classSmallPortraitObject)
        {
            StaticScripts.CreateGameObj("Hero_portrait", pathToTexture, new Vector3(0.18f, 0.18f), new Vector3(-0.21f, -2.83f, 10f), child: true, parentName: "MainMenuSceneObject");
        }
        else
        {
            classSmallPortraitObject.GetComponent <SpriteRenderer>().sprite = StaticScripts.CreateSprite(pathToTexture);
        }

        if (!classSmallPortraitObject)
        {
            StaticScripts.CreateGameObj("Hero_border", @"Portraits/Heroes/ParagonBorders/Prestige_PortraitFrame_00",
                                        new Vector3(0.85f, 0.85f), new Vector3(-0.45f, -3.35f, 5f), child: true, parentName: "MainMenuSceneObject");
        }

        if (!classSmallPortraitObject)
        {
            StaticScripts.CreateTextObj("HeroLevel", Account.CurrentAccount.GetCurrentHero().Level.ToString(),
                                        new Vector3(0.02f, 0.02f), new Vector3(Account.CurrentAccount.GetCurrentHero().Level > 9 ? 0.4f : 0.45f, 1.35f, 10f), FontType.StandartFont, 80, Color.white,
                                        TextAlignment.Center, true, "Hero_border");
        }
        else
        {
            var border = gameObject.transform.FindChild("Hero_border");
            if (border)
            {
                var levelTextObject = border.FindChild("HeroLevel");
                levelTextObject.gameObject.GetComponent <TextMesh>().text = Account.CurrentAccount.GetCurrentHero().Level.ToString();
                levelTextObject.gameObject.transform.localPosition        = new Vector3(Account.CurrentAccount.GetCurrentHero().Level > 9 ? 0.4f : 0.45f, 1.35f, 10f);
            }
        }

        if (!classSmallPortraitObject)
        {
            var nameTextObject = StaticScripts.CreateTextObj("HeroName", Account.CurrentAccount.GetCurrentHero().Name,
                                                             new Vector3(0.02f, 0.02f), new Vector3(0.45f, 1.6f, 10f), FontType.StandartFont, 100, new Color32(131, 176, 209, 255),
                                                             TextAlignment.Center, true, "Hero_border");
            nameTextObject.transform.localPosition = new Vector3(nameTextObject.transform.localPosition.x - nameTextObject.GetComponent <Renderer>().bounds.size.x / 2, nameTextObject.transform.localPosition.y);
        }
        else
        {
            var border = gameObject.transform.FindChild("Hero_border");
            if (border)
            {
                var nameTextObject = border.FindChild("HeroName");
                nameTextObject.gameObject.GetComponent <TextMesh>().text = Account.CurrentAccount.GetCurrentHero().Name;
                nameTextObject.gameObject.transform.localPosition        = new Vector3(0.45f, 1.6f, 10f);
                nameTextObject.transform.localPosition = new Vector3(nameTextObject.transform.localPosition.x - nameTextObject.GetComponent <Renderer>().bounds.size.x / 2, nameTextObject.transform.localPosition.y);
            }
        }

        if (!classSmallPortraitObject)
        {
            StaticScripts.CreateGameObj("LevelTextGlowGameObject", "Effects/TextGlowBlack", new Vector3(0.1f, 0.6f),
                                        new Vector3(-0.23f, -2.8f, 3f), child: true, parentName: "MainMenuSceneObject");

            StaticScripts.CreateGameObj("NameTextGlowGameObject", "Effects/TextGlowBlack", new Vector3(0.6f, 0.7f),
                                        new Vector3(-1.2f, -2.75f, 3f), child: true, parentName: "MainMenuSceneObject");
        }
    }
Esempio n. 23
0
    protected void OnMouseEnter()
    {
        isHovered = true;

        if (!tooltipObject)
        {
            tooltipObject = new GameObject("TooltipGameObject");
        }
        tooltipObject.transform.parent   = transform.parent;
        tooltipObject.transform.position = new Vector3(transform.position.x + GetComponent <Renderer>().bounds.size.x,
                                                       Item.Size == 1 ? transform.position.y + GetComponent <Renderer>().bounds.size.y / 2f : transform.position.y + (GetComponent <Renderer>().bounds.size.y / 4f) * 3f);
        StaticScripts.CreateGameObj("TitleTopGameObject", "Borders/InGame/Inventory/Tooltip_Frame_Title_Top", new Vector3(0.9f, 0.9f),
                                    new Vector3(0f, 0f), child: true, parentName: tooltipObject.name, sortingOrder: 6);
        StaticScripts.CreateGameObj("TitleMiddleGameObject", "Borders/InGame/Inventory/Tooltip_Frame_Cost", new Vector3(0.9f, 0.9f),
                                    new Vector3(0f, -0.3f), child: true, parentName: tooltipObject.name, sortingOrder: 5);
        StaticScripts.CreateGameObj("TitleBottomGameObject", "Borders/InGame/Inventory/Tooltip_Frame_Title_Bottom", new Vector3(0.9f, 0.9f),
                                    new Vector3(0f, -0.3f), child: true, parentName: tooltipObject.name, sortingOrder: 6);

        var pathToTitleQualityBackground = "";
        var textColor = new Color32();

        switch (Item.Quality)
        {
        case ItemQuality.Rare:
            pathToTitleQualityBackground = "Borders/InGame/Inventory/Tooltip_Frame_QualityColor_Rare";
            textColor = new Color32(195, 201, 101, 255);
            break;

        case ItemQuality.Legendary:
            pathToTitleQualityBackground = "Borders/InGame/Inventory/Tooltip_Frame_QualityColor_Legendary";
            textColor = new Color32(129, 84, 61, 255);
            break;

        case ItemQuality.Set:
            pathToTitleQualityBackground = "Borders/InGame/Inventory/Tooltip_Frame_QualityColor_Set";
            textColor = new Color32(73, 202, 75, 255);
            break;
        }
        StaticScripts.CreateGameObj("TitleQualityBackgroundGameObject", pathToTitleQualityBackground,
                                    new Vector3(0.9f, 0.4f), new Vector3(0.3f, -0.21f, 0f), child: true, parentName: tooltipObject.name, sortingOrder: 7);

        var Description = ((DescriptionAttribute[])Item.Type.GetType()
                           .GetField(Item.Type.ToString()).GetCustomAttributes(typeof(DescriptionAttribute), false)); //the easy way to get names with spaces

        var ItemTypeText = StaticScripts.CreateTextObj("ItemTypeTextObject", string.Format("{0} {1}", Item.Quality, Description[0].Description), new Vector3(0.02f, 0.02f),
                                                       new Vector3(0.95f, -0.4f), FontType.StandartFont, Item.Type == ItemType.MightyWeapon2H ? 82 : 90, textColor, TextAlignment.Left, true,
                                                       tooltipObject.name);

        ItemTypeText.GetComponent <Renderer>().sortingOrder = 6;

        StaticScripts.CreateGameObj("StatsTopGameObject", "Borders/InGame/Inventory/Tooltip_Frame_Tile_Top", new Vector3(0.9f, 0.9f),
                                    new Vector3(0f, -0.4f), child: true, parentName: tooltipObject.name, sortingOrder: 5);
        var firstMiddleGameObject = StaticScripts.CreateGameObj("StatsMiddleGameObject1", "Borders/InGame/Inventory/Tooltip_Frame_Tile_Middle", new Vector3(0.9f, 0.9f),
                                                                new Vector3(0f, -0.9f), child: true, parentName: tooltipObject.name, sortingOrder: 5);

        var lastMiddleTileGameObject = StaticScripts.CreateGameObj("StatsMiddleGameObject2",
                                                                   "Borders/InGame/Inventory/Tooltip_Frame_Tile_Middle", new Vector3(0.9f, 0.9f),
                                                                   new Vector3(0f, -1.4f), child: true, parentName: tooltipObject.name, sortingOrder: 5);


        #region ItemIcon

        if (Item.Size == 1)
        {
            StaticScripts.CreateGameObj("tooltipIconGameObject",
                                        "Borders/InGame/Inventory/Tooltip_IconFrame_Small", new Vector3(0.9f, 0.9f), new Vector3(0.2f, -1f),
                                        child: true, parentName: tooltipObject.name, sortingOrder: 6);

            string pathToQualityBackground = "";
            switch (Item.Quality)
            {
            case ItemQuality.Rare:
                pathToQualityBackground = "Borders/InGame/Inventory/Quality_Small_Equip_Rare";
                break;

            case ItemQuality.Legendary:
                pathToQualityBackground = "Borders/InGame/Inventory/Quality_Small_Inventory_Legendary";
                break;

            case ItemQuality.Set:
                pathToQualityBackground = "Borders/InGame/Inventory/Quality_Small_Inventory_Set";
                break;
            }

            StaticScripts.CreateGameObj("tooltipQualityGameObject", pathToQualityBackground, new Vector3(0.9f, 0.9f),
                                        new Vector3(0.24f, -0.95f), child: true, parentName: tooltipObject.name, sortingOrder: 6);

            if (Item.Name != null)
            {
                if (
                    Resources.Load <Texture2D>(string.Format(@"Items/{0}/{0}_{1}", Item.Type, Item.Name.Replace(" ", "_"))))
                {
                    StaticScripts.CreateGameObj("tooltipItemIconGameObject",
                                                string.Format(@"Items/{0}/{0}_{1}", Item.Type, Item.Name.Replace(" ", "_")),
                                                new Vector3(0.75f, 0.75f), new Vector3(0.28f, -0.93f),
                                                child: true, parentName: tooltipObject.name, sortingOrder: 7);
                }
            }
        }
        else
        {
            lastMiddleTileGameObject = StaticScripts.CreateGameObj("StatsMiddleGameObject3",
                                                                   "Borders/InGame/Inventory/Tooltip_Frame_Tile_Middle", new Vector3(0.9f, 0.9f),
                                                                   new Vector3(0f, -1.9f), child: true, parentName: tooltipObject.name, sortingOrder: 5);

            var armorAmountTextObject = StaticScripts.CreateTextObj("ArmorAmountTextObject", Item.Armor.ToString(), new Vector3(0.02f, 0.02f),
                                                                    new Vector3(0.95f, -0.65f), FontType.StandartFont, 260, Color.white, TextAlignment.Left, true,
                                                                    tooltipObject.name);
            armorAmountTextObject.GetComponent <Renderer>().sortingOrder = 6;

            var armorTextObject = StaticScripts.CreateTextObj("ArmorTextObject", "Armor", new Vector3(0.02f, 0.02f),
                                                              new Vector3(0.95f, -1.25f), FontType.StandartFont, 80, new Color32(110, 110, 110, 255), TextAlignment.Left, true,
                                                              tooltipObject.name);
            armorTextObject.GetComponent <Renderer>().sortingOrder = 6;

            StaticScripts.CreateGameObj("tooltipIconGameObject",
                                        "Borders/InGame/Inventory/Tooltip_IconFrame_Large", new Vector3(0.9f, 0.9f), new Vector3(0.2f, -1.6f),
                                        child: true, parentName: tooltipObject.name, sortingOrder: 6);

            string pathToQualityBackground = "";
            switch (Item.Quality)
            {
            case ItemQuality.Rare:
                pathToQualityBackground = "Borders/InGame/Inventory/Quality_Large_Equip_Rare";
                break;

            case ItemQuality.Legendary:
                pathToQualityBackground = "Borders/InGame/Inventory/Quality_Large_Equip_Legendary";
                break;

            case ItemQuality.Set:
                pathToQualityBackground = "Borders/InGame/Inventory/Quality_Large_Equip_Set";
                break;
            }

            StaticScripts.CreateGameObj("tooltipQualityGameObject", pathToQualityBackground, new Vector3(0.9f, 0.9f),
                                        new Vector3(0.24f, -1.55f), child: true, parentName: tooltipObject.name, sortingOrder: 6);

            if (Item.Name != null)
            {
                if (
                    Resources.Load <Texture2D>(string.Format(@"Items/{0}/{0}_{1}", Item.Type, Item.Name.Replace(" ", "_"))))
                {
                    StaticScripts.CreateGameObj("tooltipItemIconGameObject",
                                                string.Format(@"Items/{0}/{0}_{1}", Item.Type, Item.Name.Replace(" ", "_")),
                                                new Vector3(0.75f, 0.75f), new Vector3(0.28f, -1.53f),
                                                child: true, parentName: tooltipObject.name, sortingOrder: 7);
                }
            }
        }

        #endregion

        var amountOfTiles = Math.Ceiling((double)Item.itemStats.Length / 2); // this helps to round number to the nearest NEXT integer

        for (int i = 0; i < amountOfTiles; i++)                              // calculate the amount of middle tiles. Depends on the amount of rolled stats
        {
            lastMiddleTileGameObject = StaticScripts.CreateGameObj(string.Format("StatsMiddleGameObject{0}", 4 + i),
                                                                   "Borders/InGame/Inventory/Tooltip_Frame_Tile_Middle", new Vector3(0.9f, 0.9f),
                                                                   new Vector3(0f, lastMiddleTileGameObject.transform.localPosition.y - 0.5f), child: true, parentName: tooltipObject.name, sortingOrder: 5);
        }

        GameObject lastItemStatObject = null;

        foreach (var stat in Item.itemStats)
        {
            if (lastItemStatObject == null)
            {
                lastItemStatObject = StaticScripts.CreateTextObj("ItemStatTextObject", string.Format("{0} {1}", stat.StatAmount, stat.stat),
                                                                 new Vector3(0.02f, 0.02f), new Vector3(0.45f, Item.Size == 2? -1.8f : -1.2f, 0f), FontType.StandartFont, 84, new Color32(75, 75, 147, 255),
                                                                 TextAlignment.Left, true, tooltipObject.name);
            }
            else
            {
                lastItemStatObject = StaticScripts.CreateTextObj("ItemStatTextObject", string.Format("{0} {1}", stat.StatAmount, stat.stat),
                                                                 new Vector3(0.02f, 0.02f), new Vector3(0.45f, lastItemStatObject.transform.localPosition.y - 0.25f, 0f), FontType.StandartFont,
                                                                 84, new Color32(75, 75, 147, 255), TextAlignment.Left, true, tooltipObject.name);
            }
            lastItemStatObject.GetComponent <Renderer>().sortingOrder = 6;

            StaticScripts.CreateGameObj("ItemStatIconGameObject", "Borders/InGame/Inventory/bullet", new Vector3(0.5f, 0.5f),
                                        new Vector3(0.25f, lastItemStatObject.transform.localPosition.y - 0.184f), child: true,
                                        parentName: tooltipObject.name, sortingOrder: 6);
        }

        var bottomTileGameObject = StaticScripts.CreateGameObj("StatsBottomGameObject",
                                                               "Borders/InGame/Inventory/Tooltip_Frame_Tile_Bottom", new Vector3(0.9f, 0.9f),
                                                               new Vector3(0f, lastMiddleTileGameObject.transform.localPosition.y - 0.1f), child: true,
                                                               parentName: tooltipObject.name, sortingOrder: 5);
        var costFrameGameObject = StaticScripts.CreateGameObj("CostGameObject",
                                                              "Borders/InGame/Inventory/Tooltip_Frame_Cost", new Vector3(0.9f, 0.9f),
                                                              new Vector3(0f, lastMiddleTileGameObject.transform.localPosition.y - 0.475f), child: true,
                                                              parentName: tooltipObject.name, sortingOrder: 5);

        StaticScripts.CreateTextObj("SellValueTextObject", "Sell Value:", new Vector3(0.02f, 0.02f), new Vector3(0.25f, 0.33f),
                                    FontType.StandartFont, 88, new Color32(186, 178, 155, 255), TextAlignment.Left, true,
                                    costFrameGameObject.name);

        var sellValueTextObject = StaticScripts.CreateTextObj("SellValuePriceTextObject", Item.SellValue.ToString(), new Vector3(0.02f, 0.02f),
                                                              new Vector3(1.2f, 0.33f), FontType.StandartFont, 88, Color.white, TextAlignment.Left, true, costFrameGameObject.name, FontStyle.Bold);
        StaticScripts.CreateGameObj("SellValueIconGameObject", "Borders/InGame/Inventory/gold", new Vector3(0.55f, 0.55f),
                                    new Vector3(1.2f + sellValueTextObject.GetComponent <Renderer>().bounds.size.x + 0.15f, 0.135f), child: true, parentName: costFrameGameObject.name);

        var endOfTooltipGameObject = StaticScripts.CreateGameObj("EndOfTooltipGameObject",
                                                                 "Borders/InGame/Inventory/Tooltip_Frame_Bottom", new Vector3(0.9f, 0.9f),
                                                                 new Vector3(0f, lastMiddleTileGameObject.transform.localPosition.y - 0.53f), child: true,
                                                                 parentName: tooltipObject.name, sortingOrder: 5);

        //Check if there is enough space to show tooltip on the right bottom side of the screen. If there is no space then tooltip will be moved to fill.

        var screenBorders = Camera.main.ScreenToWorldPoint(new Vector3(Screen.width, Screen.height));
        if (tooltipObject.transform.position.x + endOfTooltipGameObject.GetComponent <Renderer>().bounds.size.x > screenBorders.x)
        {
            tooltipObject.transform.position = new Vector3(transform.position.x - endOfTooltipGameObject.GetComponent <Renderer>().bounds.size.x, tooltipObject.transform.position.y);
        }

        if (endOfTooltipGameObject.transform.position.y - endOfTooltipGameObject.GetComponent <Renderer>().bounds.size.y < screenBorders.y * -1)
        {
            tooltipObject.transform.position = new Vector3(tooltipObject.transform.position.x, screenBorders.y * -1 + Math.Abs(endOfTooltipGameObject.transform.localPosition.y - endOfTooltipGameObject.GetComponent <Renderer>().bounds.size.y) + 0.2f);
        }
    }
Esempio n. 24
0
    /*
     * This method draws a menu which can be called with the right mouse button click.
     * That menu have three buttons:
     * - Trash (removing item from the inventory)
     * - Equip (equipping that item if it's possible)
     * - Cancel (hides menu)
     * Right-clicking on the another item will close previous menu
     */
    protected IEnumerator DrawRMBMenu()
    {
        if (tooltipObject != null)
        {
            tooltipObject.SetActive(false);
            Destroy(tooltipObject);
        }
        if (GameObject.Find("RMBMenuGameObject"))
        {
            var prevObject = GameObject.Find("RMBMenuGameObject");
            prevObject.name += "_old";
            prevObject.SetActive(false);
            Destroy(prevObject);
        }

        yield return(1); //wait for the next frame to be sure that objects are killed

        var mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);
        var menuBorder    = StaticScripts.CreateGameObj("RMBMenuGameObject", "Borders/InGame/Inventory/QuestReward_Base2",
                                                        new Vector3(0.7f, 0.8f, -5f), new Vector3(0f, 0f, 0f), true, 1, child: true, parentName: transform.parent.parent.parent.name, sortingOrder: 10);

        menuBorder.transform.position = new Vector3(mousePosition.x + 0.1f, mousePosition.y, -1f);
        menuBorder.GetComponent <Collider2D>().isTrigger = true;

        var cancelButton = StaticScripts.CreateGameObj("CancelButtonGameObject", "Buttons/D3_Btn_Reward_Up",
                                                       new Vector3(1.35f, 0.95f), new Vector3(0.25f, 0.2f, 1f), true, 1, true, typeof(ButtonBaseMouseEvents), true,
                                                       menuBorder.name);

        var cancelButtonTextObject = StaticScripts.CreateTextObj("CancelButtonTextObject", "Cancel",
                                                                 new Vector3(0.02f, 0.02f), new Vector3(1.165f, 0.36f), FontType.DiabloFont, 110, new Color32(243, 170, 85, 255),
                                                                 TextAlignment.Left, true, cancelButton.name);

        cancelButtonTextObject.transform.localScale = new Vector3(1f, 1.2f);

        var buttonEquip = StaticScripts.CreateGameObj("EquipItemButtonGameObject", "Buttons/D3_Btn_Reward_Up",
                                                      new Vector3(1.35f, 0.95f), new Vector3(0.25f, 0.725f, 1f), true, 1, true, typeof(ButtonBaseMouseEvents), true,
                                                      menuBorder.name);

        var buttonEquipTextObject = StaticScripts.CreateTextObj("EquipButtonTextObject", "Equip",
                                                                new Vector3(0.02f, 0.02f), new Vector3(1.25f, 0.36f), FontType.DiabloFont, 110, new Color32(243, 170, 85, 255),
                                                                TextAlignment.Left, true, buttonEquip.name);

        buttonEquipTextObject.transform.localScale = new Vector3(1f, 1.2f);

        var buttonTrash = StaticScripts.CreateGameObj("TrashItemButtonGameObject", "Buttons/D3_Btn_Reward_Up",
                                                      new Vector3(1.35f, 0.95f), new Vector3(0.25f, 1.25f, 1f), true, 1, true, typeof(ButtonBaseMouseEvents), true,
                                                      menuBorder.name);

        var buttonTrashTextObject = StaticScripts.CreateTextObj("TrashButtonTextObject", "Trash",
                                                                new Vector3(0.02f, 0.02f), new Vector3(1.25f, 0.36f), FontType.DiabloFont, 110, new Color32(243, 170, 85, 255),
                                                                TextAlignment.Left, true, buttonTrash.name);

        buttonTrashTextObject.transform.localScale = new Vector3(1f, 1.2f);

        buttonTrash.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
        {
            Account.CurrentAccount.GetCurrentHero().InventoryClass.RemoveFromInventory(Item.LeftTopCornerCoordinate);
            menuBorder.SetActive(false);
            Destroy(menuBorder);
        };

        cancelButton.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
        {
            menuBorder.SetActive(false);
            Destroy(menuBorder);
        };

        buttonEquip.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
        {
            Account.CurrentAccount.GetCurrentHero().InventoryClass.EquipItem(Item.LeftTopCornerCoordinate);
            menuBorder.SetActive(false);
            Destroy(menuBorder);
        };
    }
    // Use this for initialization
    void Start()
    {
        StaticScripts.CreateGameObj("CreateHeroHeaderBorder", @"Borders/CharacterCreation/BattlenetHeroCreate_Header", new Vector3(1.1f, 1.1f), new Vector3(-8f, 2.625f, 10f), child: true, parentName: "CharacterCreationSceneObject");
        var backButton = StaticScripts.CreateGameObj("BackButton", @"Buttons/BattleNetButton_ClearUp_260x50", new Vector3(0.8f, 0.6f), new Vector3(-7.67f, -4.33f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), child: true, parentName: "CharacterCreationSceneObject");

        backButton.GetComponent <ButtonBaseMouseEvents>()._State         = ButtonState.Up;
        backButton.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
        {
            Account.CurrentAccount.DeleteHero(Account.CurrentAccount.GetCurrentHero());
            if (Account.CurrentAccount.CurrentHeroId == -1)
            {
                GameObject.Find("MainLogic").GetComponent <Main>().CurrentGameState = GameState.Login;
                return;
            }
            GameObject.Find("MainLogic").GetComponent <Main>().CurrentGameState = GameState.MainMenu;
        };
        StaticScripts.CreateTextObj("BackButtonText", "Back", new Vector3(0.02f, 0.02f), new Vector3(1f, 0.44f, 0f), FontType.DiabloFont, 100, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "BackButton");

        #region ClassDetails

        var classDetailTex = string.Empty;
        switch (selectedClass)
        {
        case GameClasses.Barbarian:
            classDetailTex = @"Borders/CharacterCreation/BattleNetHeroCreate_DetailsBarbarian";
            break;

        case GameClasses.Crusader:
            classDetailTex = @"Borders/CharacterCreation/BattleNetHeroCreate_DetailsCrusader";
            break;

        case GameClasses.DemonHunter:
            classDetailTex = @"Borders/CharacterCreation/BattleNetHeroCreate_DetailsDemonHunter";
            break;

        case GameClasses.Monk:
            classDetailTex = @"Borders/CharacterCreation/BattleNetHeroCreate_DetailsMonk";
            break;

        case GameClasses.WitchDoctor:
            classDetailTex = @"Borders/CharacterCreation/BattleNetHeroCreate_DetailsWitchDoctor";
            break;

        case GameClasses.Wizard:
            classDetailTex = @"Borders/CharacterCreation/BattleNetHeroCreate_DetailsWizard";
            break;
        }

        StaticScripts.CreateGameObj("ClassDetails", classDetailTex, new Vector3(0.85f, 0.85f), new Vector3(4f, -4.39f, 10f), child: true, parentName: "CharacterCreationSceneObject");

        #endregion

        #region HeroName

        StaticScripts.CreateGameObj("NameTextBox", @"Borders/CharacterCreation/BattleNetHeroCreate_TextInput", new Vector3(0.8f, 0.8f), new Vector3(-1.56f, -3.8f, 10f), true, 1, true, typeof(CharacterCreationTextBox), child: true, parentName: "CharacterCreationSceneObject");
        var createHeroButton = StaticScripts.CreateGameObj("CreateHeroButton", @"Buttons/BattleNetButton_RedDisabled_398x82", new Vector3(0.8f, 0.6f), new Vector3(-1.585f, -4.35f, 10f), true, 1, true, typeof(CharacterCreationCreateHeroButtonEvents), child: true, parentName: "CharacterCreationSceneObject");
        createHeroButton.GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Disabled;
        StaticScripts.CreateTextObj("CreateHeroButtonText", "Create Hero", new Vector3(0.02f, 0.02f), new Vector3(1.18f, 0.5f, 0f), FontType.DiabloFont, 110, new Color32(79, 75, 70, 255), TextAlignment.Center, true, "CreateHeroButton");
        StaticScripts.CreateTextObj("EnterHeroNameText", "Enter Hero Name:", new Vector3(0.02f, 0.02f), new Vector3(-0.9f, -2.9f, 10f), FontType.StandartFont, 110, new Color32(255, 225, 173, 255), TextAlignment.Center, true, "CharacterCreationSceneObject");

        #endregion

        StaticScripts.CreateTextObj("CreateHeroText", "Choose your class", new Vector3(0.02f, 0.02f, 0.02f), new Vector3(-0.15f, 0.45f, 0f), FontType.DiabloFont, 125, new Color32(255, 246, 222, 255), TextAlignment.Center, true, "CreateHeroHeaderBorder");


        StaticScripts.CreateGameObj("CreateHeroGenderBorder", @"Borders/CharacterCreation/BattlenetHeroCreate_GenderButtons", new Vector3(0.8f, 0.8f), new Vector3(-8f, -2.17f, 10f), child: true, parentName: "CharacterCreationSceneObject");
        StaticScripts.CreateGameObj("MaleButton", @"Icons/CharacterCreation/BattleNetHeroCreate_GenderMaleSelected", new Vector3(0.65f, 0.65f), new Vector3(-7.35f, -1.92f, 5f), true, 1, true, typeof(CharacterCreationGenderMouseEvents), true, "CharacterCreationSceneObject");

        StaticScripts.CreateGameObj("FemaleButton", @"Icons/CharacterCreation/BattleNetHeroCreate_GenderFemaleUp", new Vector3(0.65f, 0.65f), new Vector3(-6.55f, -1.92f, 5f), true, 1, true, typeof(CharacterCreationGenderMouseEvents), true, "CharacterCreationSceneObject");
        StaticScripts.CreateTextObj("MaleButtonText", "Male", new Vector3(0.02f, 0.02f), new Vector3(0.95f, 0.3f, 0f), FontType.DiabloFont, 80, new Color32(128, 100, 75, 255), TextAlignment.Center, true, "CreateHeroGenderBorder");
        StaticScripts.CreateTextObj("FemaleButtonText", "Female", new Vector3(0.02f, 0.02f), new Vector3(1.85f, 0.3f, 0f), FontType.DiabloFont, 80, new Color32(128, 100, 75, 255), TextAlignment.Center, true, "CreateHeroGenderBorder");

        StaticScripts.CreateGameObj("HeroicCheckBox", @"UI/BattleNetLogin_CheckboxUp", new Vector3(0.8f, 0.8f), new Vector3(-7.62f, -2.792f, 0f), true, 1, true, typeof(CharacterCreationHeroicCheckBoxScript), true, "CharacterCreationSceneObject");
        StaticScripts.CreateGameObj("HeroicIcon", @"Icons/CharacterCreation/BattleNet_HardcoreIcon", new Vector3(1f, 1f), new Vector3(0.4f, 0.01f, 0f), true, 1, child: true, parentName: "HeroicCheckBox");
        StaticScripts.CreateTextObj("HeroicText", "Hardcore Hero", new Vector3(0.02f, 0.02f), new Vector3(0.7f, 0.3f, 0f), FontType.StandartFont, 100, new Color32(128, 100, 75, 255), TextAlignment.Left, true, "HeroicCheckBox", FontStyle.Bold);
    }
Esempio n. 26
0
    void Start()
    {
        var arrayOfNames = new[] { "Bonus Experience", "Life On Hit", "Magic Find", "Gold Find" };

        for (int i = 0; i < 4; i++)
        {
            StaticScripts.CreateGameObj(string.Format("SkillsPanel_{0}", i), "Borders/InGame/SkillsPane_Paragon_StatBase",
                                        new Vector3(0.9f, 0.9f), new Vector3(1.15f, 1.6f - (1f * i), 20f), child: true, parentName: name, sortingOrder: 3);

            StaticScripts.CreateTextObj(string.Format("SkillsPanelText_{0}", i), arrayOfNames[i],
                                        new Vector3(0.02f, 0.02f), new Vector3(1.2f, 0.64f), FontType.StandartFont, 100,
                                        new Color32(243, 170, 85, 255), TextAlignment.Center, true, string.Format("SkillsPanel_{0}", i));

            var minusButtonObject = StaticScripts.CreateGameObj(string.Format("SkillsPanel_{0}_Minus", i), "Buttons/D3_ListBtn_Collapse_Up",
                                                                new Vector3(1f, 1f), new Vector3(6.3f, 0.37f), true, 1, true, typeof(ButtonBaseMouseEvents), true,
                                                                string.Format("SkillsPanel_{0}", i));

            var plusButtonObject = StaticScripts.CreateGameObj(string.Format("SkillsPanel_{0}_Plus", i), "Buttons/D3_ListBtn_Expand_Up",
                                                               new Vector3(1f, 1f), new Vector3(7.2f, 0.37f), true, 1, true, typeof(ButtonBaseMouseEvents), true,
                                                               string.Format("SkillsPanel_{0}", i));

            var spentPointsBonusText = StaticScripts.CreateTextObj(string.Format("SkillsPanel_{0}_SpentPointsBonus", i), "0",
                                                                   new Vector3(0.02f, 0.02f), new Vector3(3.8f, 0.65f), FontType.StandartFont, 130, Color.white,
                                                                   TextAlignment.Center, true, string.Format("SkillsPanel_{0}", i), FontStyle.Bold);

            var spentPointsText = StaticScripts.CreateTextObj(string.Format("SkillsPanel_{0}_SpentPoints", i), "0",
                                                              new Vector3(0.02f, 0.02f), new Vector3(0f, 0f), FontType.StandartFont, 120, Color.white,
                                                              TextAlignment.Center, true, string.Format("SkillsPanel_{0}", i), FontStyle.Bold);
            spentPointsText.transform.localPosition = new Vector3(6.85f - (spentPointsText.GetComponent <Renderer>().bounds.size.x / 4f), 0.64f);

            switch (i)
            {
            case 0:
                bonusExperiencePointsTextObject      = spentPointsText;
                bonusExperiencePointsBonusTextObject = spentPointsBonusText;

                plusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().AddTalentPoint(CurrentTab.Utility, 1);
                };

                minusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().SubtractTalentPoints(CurrentTab.Utility, 1);
                };

                break;

            case 1:
                lifeOnHitPointsTextObject      = spentPointsText;
                lifeOnHitPointsBonusTextObject = spentPointsBonusText;

                plusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().AddTalentPoint(CurrentTab.Utility, 2);
                };

                minusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().SubtractTalentPoints(CurrentTab.Utility, 2);
                };

                break;

            case 2:
                magicFindPointsTextObject      = spentPointsText;
                magicFindPointsBonusTextObject = spentPointsBonusText;

                plusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().AddTalentPoint(CurrentTab.Utility, 3);
                };

                minusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().SubtractTalentPoints(CurrentTab.Utility, 3);
                };

                break;

            case 3:
                goldFindPointsObject      = spentPointsText;
                goldFindPointsBonusObject = spentPointsBonusText;

                plusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().AddTalentPoint(CurrentTab.Utility, 4);
                };

                minusButtonObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate
                {
                    Account.CurrentAccount.GetCurrentHero().SubtractTalentPoints(CurrentTab.Utility, 4);
                };

                break;
            }
        }


        unspentPointsTextObject = StaticScripts.CreateTextObj("UnspentPointsTextObject", string.Format("Utility Unspent Points: {0}", 0),
                                                              new Vector3(0.02f, 0.02f), new Vector3(0f, 0f), FontType.StandartFont, 80, new Color32(173, 164, 135, 255),
                                                              TextAlignment.Center, true, name, FontStyle.Bold);
        unspentPointsTextObject.transform.localPosition = new Vector3(4.6f - (unspentPointsTextObject.GetComponent <Renderer>().bounds.size.x / 2f), -1.5f);
        unspentPointsTextObject.transform.localScale    = new Vector3(1f, 1.1f);

        totalPointsTextObject = StaticScripts.CreateTextObj("PointsTotalTextObject", string.Format("Utility Points Total: {0}", 0),
                                                            new Vector3(0.02f, 0.02f), new Vector3(0f, 0f), FontType.StandartFont, 80, new Color32(173, 164, 135, 255),
                                                            TextAlignment.Center, true, name, FontStyle.Bold);
        totalPointsTextObject.transform.localPosition = new Vector3(4.6f - (totalPointsTextObject.GetComponent <Renderer>().bounds.size.x / 2f), -1.8f);
        totalPointsTextObject.transform.localScale    = new Vector3(1f, 1.1f);

        var resetButtonGameObject = StaticScripts.CreateGameObj("ResetButton", "Buttons/BattleNetButton_RedUp_262x50", new Vector3(0.8f, 0.9f),
                                                                new Vector3(3.6f, -2.85f, 10f), true, 1, true, typeof(ButtonBaseMouseEvents), true, name);

        resetButtonGameObject.GetComponent <ButtonBaseMouseEvents>().MethodOnClick += delegate { Account.CurrentAccount.GetCurrentHero().ResetTalentPoints(CurrentTab.Utility); };
        StaticScripts.CreateTextObj("ResetButtonText", "Reset", new Vector3(0.02f, 0.02f), new Vector3(0.95f, 0.35f, 0f),
                                    FontType.DiabloFont, 100, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "ResetButton");
    }
Esempio n. 27
0
    new void OnMouseDown()
    {
        base.OnMouseDown();
        if (_State == ButtonState.Disabled)
        {
            return;
        }
        if (GameObject.Find("LogonStatusWindow") != null)
        {
            return;
        }
        var textBoxes = GameObject.Find("LoginAndPasswordTextBoxes");
        var login     = textBoxes.GetComponent <LoginPasswordTextBoxesScript>().AccountName;
        var pass      = textBoxes.GetComponent <LoginPasswordTextBoxesScript>().Password;


        try
        {
            using (var sr = new StreamReader(new FileStream(@"Accounts.txt", FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite)))
            {
                bool flag = false;
                while (!flag && !sr.EndOfStream)
                {
                    var text = sr.ReadLine();
                    if (login == text)
                    {
                        if (pass == sr.ReadLine())
                        {
                            flag = true;
                            ReadWriteAccountDateScript.ReadAccountData(login);
                            DestroyImmediate(GameObject.Find("LoginSceneObject"));
                            GameObject.Find("MainLogic").GetComponent <Main>().CurrentGameState = GameState.MainMenu;
                        }
                        else
                        {
                            StaticScripts.CreateGameObj("LogonStatusWindow", @"Borders/Login/BattleNetLogin_LogonStatusWindow", new Vector3(0.85f, 0.85f), new Vector3(-2.35f, -2.05f, -2f), sortingOrder: 10);
                            StaticScripts.CreateGameObj("LogonButtonOk", @"Buttons/BattleNetButton_RedUp_245x66", new Vector3(1f, 1f), new Vector3(1.5f, 0.4f, -3f), true, 1, true, typeof(CancelButtonScript), true, "LogonStatusWindow");
                            StaticScripts.CreateTextObj("WarningText", "Your login information is incorrect. Please try again.", new Vector3(0.02f, 0.02f), new Vector3(0.8f, 2.8f, -5f), FontType.StandartFont, 80, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "LogonStatusWindow");
                            StaticScripts.CreateTextObj("WarningTitle", "WARNING!", new Vector3(0.02f, 0.02f), new Vector3(2.35f, 3.95f, -5f), FontType.StandartFont, 80, new Color32(243, 170, 85, 255), child: true, parentName: "LogonStatusWindow");
                            StaticScripts.CreateTextObj("OKButtonText", "OK", new Vector3(0.02f, 0.02f), new Vector3(1.1f, 0.4f, -5f), FontType.DiabloFont, 80, new Color32(243, 170, 85, 255), child: true, parentName: "LogonButtonOk");
                            return;
                        }
                    }
                }

                if (!flag)
                {
                    StaticScripts.CreateGameObj("LogonStatusWindow", @"Borders/Login/BattleNetLogin_LogonStatusWindow", new Vector3(0.85f, 0.85f), new Vector3(-2.35f, -2.05f, -2f), sortingOrder: 10);
                    StaticScripts.CreateGameObj("LogonButtonCreate", @"Buttons/BattleNetButton_RedUp_245x66", new Vector3(1f, 1f), new Vector3(0.3f, 0.35f, -3f), true, 1, true, typeof(CreateNewAccountButtonScript), true, "LogonStatusWindow");
                    StaticScripts.CreateGameObj("LogonButtonCancel", @"Buttons/BattleNetButton_RedUp_245x66", new Vector3(1f, 1f), new Vector3(2.78f, 0.35f, -3f), true, 1, true, typeof(CancelButtonScript), true, "LogonStatusWindow");
                    StaticScripts.CreateTextObj("WarningTitle", "WARNING!", new Vector3(0.02f, 0.02f), new Vector3(2.35f, 3.95f, -5f), FontType.StandartFont, 80, new Color32(243, 170, 85, 255), child: true, parentName: "LogonStatusWindow");
                    StaticScripts.CreateTextObj("WarningText", "There is no information about an account with such\nname. Do you want to create new account with that \nname?", new Vector3(0.02f, 0.02f), new Vector3(0.8f, 2.8f, 0f), FontType.StandartFont, 80, new Color32(243, 170, 85, 255), TextAlignment.Center, true, "LogonStatusWindow");
                    StaticScripts.CreateTextObj("CreateButtonText", "Create", new Vector3(0.02f, 0.02f), new Vector3(0.85f, 0.4f, -5f), FontType.DiabloFont, 80, new Color32(243, 170, 85, 255), child: true, parentName: "LogonButtonCreate");
                    StaticScripts.CreateTextObj("CancelButtonText", "Cancel", new Vector3(0.02f, 0.02f), new Vector3(0.9f, 0.4f, -5f), FontType.DiabloFont, 80, new Color32(243, 170, 85, 255), child: true, parentName: "LogonButtonCancel");
                }
            }
        }
        catch (Exception ex)
        {
            Debug.LogException(ex, this);
        }
    }
Esempio n. 28
0
    void Start()
    {
        Account.CurrentAccount.GetCurrentHero().InventoryClass.InventoryChangedEvent += ShowEquippedItems;
        string backgroundTex = "";

        switch (Account.CurrentAccount.GetCurrentHero().Class)
        {
        case GameClasses.Barbarian:
            backgroundTex = Account.CurrentAccount.GetCurrentHero().Gender
                    ?"Borders/InGame/Inventory/Class_Background_Barbarian_Male" :
                            "Borders/InGame/Inventory/Class_Background_Barbarian_Female";
            break;

        case GameClasses.Crusader:
            backgroundTex = Account.CurrentAccount.GetCurrentHero().Gender
                    ? "Borders/InGame/Inventory/Class_Background_Crusader_Male"
                    : "Borders/InGame/Inventory/Class_Background_Crusader_Female";
            break;

        case GameClasses.DemonHunter:
            backgroundTex = Account.CurrentAccount.GetCurrentHero().Gender
                     ? "Borders/InGame/Inventory/Class_Background_DemonHunter_Male"
                     : "Borders/InGame/Inventory/Class_Background_DemonHunter_Female";
            break;

        case GameClasses.Monk:
            backgroundTex = Account.CurrentAccount.GetCurrentHero().Gender
                     ? "Borders/InGame/Inventory/Class_Background_Monk_Male"
                     : "Borders/InGame/Inventory/Class_Background_Monk_Female";
            break;

        case GameClasses.WitchDoctor:
            backgroundTex = Account.CurrentAccount.GetCurrentHero().Gender
                     ? "Borders/InGame/Inventory/Class_Background_Witchdoctor_Male"
                     : "Borders/InGame/Inventory/Class_Background_Witchdoctor_Female";
            break;

        case GameClasses.Wizard:
            backgroundTex = Account.CurrentAccount.GetCurrentHero().Gender
                     ? "Borders/InGame/Inventory/Class_Background_Wizard_Male"
                     : "Borders/InGame/Inventory/Class_Background_Wizard_Female";
            break;
        }
        var background = StaticScripts.CreateGameObj("classBackground", backgroundTex, new Vector3(1.5f, 1.4f), new Vector3(1f, -3.14f, 10f), child: true, parentName: name, sortingOrder: 3);

        var levelTextObject = StaticScripts.CreateTextObj("LevelTextObject", "Level:", new Vector3(0.02f, 0.02f), new Vector3(0.15f, 4.1f, 0f),
                                                          FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center, true, background.name);

        levelTextObject.transform.localScale = new Vector3(1f, 1.05f);

        LevelAmountTextObject = StaticScripts.CreateTextObj("CharacterTextObject", Account.CurrentAccount.GetCurrentHero().Level.ToString(),
                                                            new Vector3(0.02f, 0.02f), new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white,
                                                            TextAlignment.Center, true, background.name);
        LevelAmountTextObject.transform.localScale    = new Vector3(1f, 1.05f);
        LevelAmountTextObject.transform.localPosition = new Vector3(1.7f - (LevelAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 4.115f);

        GameObject mainStatObject;

        if (Account.CurrentAccount.GetCurrentHero().Class == GameClasses.Barbarian ||
            Account.CurrentAccount.GetCurrentHero().Class == GameClasses.Crusader)
        {
            mainStatObject = StaticScripts.CreateTextObj("MainStatNameTextObject", "Strength:", new Vector3(0.02f, 0.02f),
                                                         new Vector3(0.15f, 3.9f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                         true, background.name);
        }
        else if (Account.CurrentAccount.GetCurrentHero().Class == GameClasses.DemonHunter ||
                 Account.CurrentAccount.GetCurrentHero().Class == GameClasses.Monk)
        {
            mainStatObject = StaticScripts.CreateTextObj("MainStatNameTextObject", "Dexterity:", new Vector3(0.02f, 0.02f),
                                                         new Vector3(0.15f, 3.9f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                         true, background.name);
        }
        else
        {
            mainStatObject = StaticScripts.CreateTextObj("MainStatNameTextObject", "Intelligence:", new Vector3(0.02f, 0.02f),
                                                         new Vector3(0.15f, 3.9f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                         true, background.name);
        }
        mainStatObject.transform.localScale = new Vector3(1f, 1.1f);

        MainStatAmountTextObject = StaticScripts.CreateTextObj("MainStatAmountTextObject", "10", new Vector3(0.02f, 0.02f),
                                                               new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                               true, background.name);
        MainStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        MainStatAmountTextObject.transform.localPosition = new Vector3(1.7f - (MainStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 3.91f);


        var vitalityStatTextObject = StaticScripts.CreateTextObj("VitalityTextObject", "Vitality:", new Vector3(0.02f, 0.02f),
                                                                 new Vector3(0.15f, 3.7f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                                 true, background.name);

        vitalityStatTextObject.transform.localScale = new Vector3(1f, 1.1f);

        vitalityStatAmountTextObject = StaticScripts.CreateTextObj("VitalityAmountTextObject", "10", new Vector3(0.02f, 0.02f),
                                                                   new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                   true, background.name);
        vitalityStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        vitalityStatAmountTextObject.transform.localPosition = new Vector3(1.7f - (vitalityStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 3.71f);

        var goldFindTextObject = StaticScripts.CreateTextObj("GoldFindTextObject", "Gold find:", new Vector3(0.02f, 0.02f),
                                                             new Vector3(0.15f, 3.5f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                             true, background.name);

        goldFindTextObject.transform.localScale = new Vector3(1f, 1.1f);

        var goldFindStatAmountTextObject = StaticScripts.CreateTextObj("GoldFindAmountTextObject", "10 %", new Vector3(0.02f, 0.02f),
                                                                       new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                       true, background.name);

        goldFindStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        goldFindStatAmountTextObject.transform.localPosition = new Vector3(1.7f - (goldFindStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 3.51f);

        var magicFindTextObject = StaticScripts.CreateTextObj("MagicFindTextObject", "Magic find:", new Vector3(0.02f, 0.02f),
                                                              new Vector3(0.15f, 3.3f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                              true, background.name);

        magicFindTextObject.transform.localScale = new Vector3(1f, 1.1f);

        var magicFindStatAmountTextObject = StaticScripts.CreateTextObj("MagicFindAmountTextObject", "10 %", new Vector3(0.02f, 0.02f),
                                                                        new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                        true, background.name);

        magicFindStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        magicFindStatAmountTextObject.transform.localPosition = new Vector3(1.7f - (magicFindStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 3.31f);

        var critChanceTextObject = StaticScripts.CreateTextObj("CritChanceTextObject", "Critical Hit Chance:", new Vector3(0.02f, 0.02f),
                                                               new Vector3(0.15f, 3.1f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                               true, background.name);

        critChanceTextObject.transform.localScale = new Vector3(0.9f, 1.1f);

        var critChanceStatAmountTextObject = StaticScripts.CreateTextObj("CritChanceStatAmountTextObject", "10 %", new Vector3(0.02f, 0.02f),
                                                                         new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                         true, background.name);

        critChanceStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        critChanceStatAmountTextObject.transform.localPosition = new Vector3(1.7f - (critChanceStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 3.11f);

        var critDamageTextObject = StaticScripts.CreateTextObj("CritDamageTextObject", "Critical Hit Damage:", new Vector3(0.02f, 0.02f),
                                                               new Vector3(0.15f, 2.9f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                               true, background.name);

        critDamageTextObject.transform.localScale = new Vector3(0.9f, 1.1f);

        var critDamageStatAmountTextObject = StaticScripts.CreateTextObj("CritDamageStatAmountTextObject", "10 %", new Vector3(0.02f, 0.02f),
                                                                         new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                         true, background.name);

        critDamageStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        critDamageStatAmountTextObject.transform.localPosition = new Vector3(1.7f - (critDamageStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 2.91f);

        var armorTextObject = StaticScripts.CreateTextObj("ArmorTextObject", "Armor:", new Vector3(0.02f, 0.02f),
                                                          new Vector3(0.15f, 2.7f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                          true, background.name);

        armorTextObject.transform.localScale = new Vector3(1f, 1.1f);

        var armorStatAmountTextObject = StaticScripts.CreateTextObj("ArmorStatAmountTextObject", "10", new Vector3(0.02f, 0.02f),
                                                                    new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                    true, background.name);

        armorStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        armorStatAmountTextObject.transform.localPosition = new Vector3(1.7f - (armorStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 2.71f);

        var resistsTextObject = StaticScripts.CreateTextObj("ResistsTextObject", "Resist All:", new Vector3(0.02f, 0.02f),
                                                            new Vector3(0.15f, 2.5f, 0f), FontType.StandartFont, 64, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                            true, background.name);

        resistsTextObject.transform.localScale = new Vector3(1f, 1.1f);

        var resistsStatAmountTextObject = StaticScripts.CreateTextObj("ResistsStatAmountTextObject", "10", new Vector3(0.02f, 0.02f),
                                                                      new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                      true, background.name);

        resistsStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        resistsStatAmountTextObject.transform.localPosition = new Vector3(1.7f - (resistsStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 2.51f);


        //Bottom part of the list. All of them will be drawn in the middle of the border

        var damageStatTextObject = StaticScripts.CreateTextObj("DamageTextObject", "Damage per Click:",
                                                               new Vector3(0.02f, 0.02f),
                                                               new Vector3(0.4f, 2.05f, 0f), FontType.StandartFont, 68, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                               true, background.name);

        damageStatTextObject.transform.localScale = new Vector3(1f, 1.1f);

        damageStatAmountTextObject = StaticScripts.CreateTextObj("DamageAmountTextObject", "100 000", new Vector3(0.02f, 0.02f),
                                                                 new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                 true, background.name);
        damageStatAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        damageStatAmountTextObject.transform.localPosition = new Vector3(0.95f - (damageStatAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 1.87f);

        var toughnessStatTextObject = StaticScripts.CreateTextObj("ToughnessTextObject", "Toughness:", new Vector3(0.02f, 0.02f),
                                                                  new Vector3(0.62f, 1.67f, 0f), FontType.StandartFont, 68, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                                  true, background.name);

        toughnessStatTextObject.transform.localScale = new Vector3(1f, 1.1f);

        var toughnessAmountTextObject = StaticScripts.CreateTextObj("ToughnessAmountTextObject", "10", new Vector3(0.02f, 0.02f),
                                                                    new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                    true, background.name);

        toughnessAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        toughnessAmountTextObject.transform.localPosition = new Vector3(0.95f - (toughnessAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 1.49f);

        var healingTextObject = StaticScripts.CreateTextObj("HealingTextObject", "Healing:", new Vector3(0.02f, 0.02f),
                                                            new Vector3(0.73f, 1.29f, 0f), FontType.StandartFont, 68, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                            true, background.name);

        healingTextObject.transform.localScale = new Vector3(1f, 1.1f);

        var healingAmountTextObject = StaticScripts.CreateTextObj("HealingAmountTextObject", "10", new Vector3(0.02f, 0.02f),
                                                                  new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                  true, background.name);

        healingAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        healingAmountTextObject.transform.localPosition = new Vector3(0.95f - (healingAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 1.11f);

        var botDamageTextObject = StaticScripts.CreateTextObj("BotDamageTextObject", "Bot Damage per Tick:", new Vector3(0.02f, 0.02f),
                                                              new Vector3(0.3f, 0.91f, 0f), FontType.StandartFont, 68, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                              true, background.name);

        botDamageTextObject.transform.localScale = new Vector3(1f, 1.1f);

        var botDamageAmountTextObject = StaticScripts.CreateTextObj("BotDamageAmountTextObject", "10", new Vector3(0.02f, 0.02f),
                                                                    new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                    true, background.name);

        botDamageAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        botDamageAmountTextObject.transform.localPosition = new Vector3(0.95f - (botDamageAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 0.73f);

        var ticksPerSecondTextObject = StaticScripts.CreateTextObj("TicksPerSecondTextObject", "Bot Ticks per second:", new Vector3(0.02f, 0.02f),
                                                                   new Vector3(0.31f, 0.53f, 0f), FontType.StandartFont, 68, new Color32(243, 170, 85, 255), TextAlignment.Center,
                                                                   true, background.name);

        ticksPerSecondTextObject.transform.localScale = new Vector3(1f, 1.1f);

        var tickPerSecondAmountTextObject = StaticScripts.CreateTextObj("TicksPerSecondAmountTextObject", "10", new Vector3(0.02f, 0.02f),
                                                                        new Vector3(0f, 0f, 0f), FontType.StandartFont, 68, Color.white, TextAlignment.Center,
                                                                        true, background.name);

        tickPerSecondAmountTextObject.transform.localScale    = new Vector3(1f, 1.1f);
        tickPerSecondAmountTextObject.transform.localPosition = new Vector3(0.95f - (tickPerSecondAmountTextObject.GetComponent <Renderer>().bounds.size.x / 4f), 0.35f);
    }
    void DrawInventory()
    {
        if (!isActiveAndEnabled)
        {
            return;
        }
        foreach (Transform child in transform)
        {
            if (child.gameObject.name.Contains("InventoryGrid_"))
            {
                child.gameObject.name = name + "_old";
                child.gameObject.SetActive(false);
                Destroy(child.gameObject);
            }
        }

        //Drawing free slots
        for (int j = 0; j < 10; j++)
        {
            for (int i = 0; i < 12; i++)
            {
                if (!Account.CurrentAccount.GetCurrentHero().InventoryClass.InventorySpace[i, j])
                {
                    StaticScripts.CreateGameObj(string.Format("InventoryGrid_{0}_{1}", j, i),
                                                "Borders/InGame/Inventory/InventoryGrid_Slot", new Vector3(0.95f, 0.95f),
                                                new Vector3(1f + (0.61f * i), 2.22f - (0.595f * j), 10f), child: true, parentName: name, sortingOrder: 3);
                }
            }
        }

        foreach (var item in Account.CurrentAccount.GetCurrentHero().InventoryClass.Inventory)
        {
            if (item.Size == 1)
            {
                var background =
                    StaticScripts.CreateGameObj(
                        string.Format("InventoryGrid_{0}_{1}", item.LeftTopCornerCoordinate.y,
                                      item.LeftTopCornerCoordinate.x), "Borders/InGame/Inventory/InventoryGrid_Slot",
                        new Vector3(0.95f, 0.95f),
                        new Vector3(1f + (0.61f * item.LeftTopCornerCoordinate.x),
                                    2.22f - (0.595f * item.LeftTopCornerCoordinate.y), 10f), true, 1, true, typeof(ShowTooltipScript), true, name,
                        sortingOrder: 3);

                background.GetComponent <ShowTooltipScript>().Item = item;

                string pathToQualityBackground = "";
                switch (item.Quality)
                {
                case ItemQuality.Rare:
                    pathToQualityBackground = "Borders/InGame/Inventory/Quality_Small_Equip_Rare";
                    break;

                case ItemQuality.Legendary:
                    pathToQualityBackground = "Borders/InGame/Inventory/Quality_Small_Inventory_Legendary";
                    break;

                case ItemQuality.Set:
                    pathToQualityBackground = "Borders/InGame/Inventory/Quality_Small_Inventory_Set";
                    break;
                }
                StaticScripts.CreateGameObj(
                    string.Format("InventoryGrid_{0}_{1}_quality", item.LeftTopCornerCoordinate.y,
                                  item.LeftTopCornerCoordinate.x), pathToQualityBackground, item.Quality == ItemQuality.Rare ? new Vector3(0.94f, 0.94f) : new Vector3(1f, 1f),
                    item.Quality == ItemQuality.Rare ? new Vector3(0.03f, 0.03f) : new Vector3(0.02f, 0.02f), child: true, parentName: background.name);


                if (item.Name == null)
                {
                    continue;
                }
                if (Resources.Load <Texture2D>(string.Format(@"Items/{0}/{0}_{1}", item.Type, item.Name.Replace(" ", "_"))))
                {
                    StaticScripts.CreateGameObj("InventoryGrid_{0}_{1}_icon",
                                                string.Format(@"Items/{0}/{0}_{1}", item.Type, item.Name.Replace(" ", "_")), new Vector3(0.9f, 0.9f), new Vector3(0.03f, 0.03f),
                                                child: true, parentName: background.name, sortingOrder: 5);
                }
            }
            else
            {
                var background = StaticScripts.CreateGameObj(string.Format("InventoryGrid_{0}_{1}", item.LeftTopCornerCoordinate.y,
                                                                           item.LeftTopCornerCoordinate.x), "Borders/InGame/Inventory/Quality_Large_Blank_Inventory", new Vector3(0.95f, 0.95f),
                                                             new Vector3(1f + (0.61f * item.LeftTopCornerCoordinate.x), 2.22f - (0.595f * (item.LeftTopCornerCoordinate.y + 1)), 10f), true, 1, true, typeof(ShowTooltipScript), child: true,
                                                             parentName: name, sortingOrder: 3);
                background.GetComponent <ShowTooltipScript>().Item = item;
                string pathToQualityBackground = "";
                switch (item.Quality)
                {
                case ItemQuality.Rare:
                    pathToQualityBackground = "Borders/InGame/Inventory/Quality_Large_Equip_Rare";
                    break;

                case ItemQuality.Legendary:
                    pathToQualityBackground = "Borders/InGame/Inventory/Quality_Large_Equip_Legendary";
                    break;

                case ItemQuality.Set:
                    pathToQualityBackground = "Borders/InGame/Inventory/Quality_Large_Equip_Set";
                    break;
                }
                StaticScripts.CreateGameObj(string.Format("InventoryGrid_{0}_{1}_quality", item.LeftTopCornerCoordinate.y,
                                                          item.LeftTopCornerCoordinate.x), pathToQualityBackground, new Vector3(1f, 1f),
                                            new Vector3(0.02f, 0.02f), child: true, parentName: background.name);

                if (item.Name == null)
                {
                    continue;
                }
                if (Resources.Load <Texture2D>(string.Format(@"Items/{0}/{0}_{1}", item.Type, item.Name.Replace(" ", "_"))))
                {
                    StaticScripts.CreateGameObj("InventoryGrid_{0}_{1}_icon",
                                                string.Format(@"Items/{0}/{0}_{1}", item.Type, item.Name.Replace(" ", "_")), new Vector3(0.9f, 0.9f), new Vector3(0.03f, 0.03f),
                                                child: true, parentName: background.name, sortingOrder: 5);
                }
            }
        }
    }
Esempio n. 30
0
    void ShowEquippedItems()
    {
        if (!isActiveAndEnabled)
        {
            return;
        }
        foreach (Transform child in transform)
        {
            if (child.gameObject.name.Contains("EquippedItem_"))
            {
                child.gameObject.name = name + "_old";
                child.gameObject.SetActive(false);
                Destroy(child.gameObject);
            }
        }

        var coordinates = new[]
        {
            new[] { 5.57f, 1.83f, 1.6f, 0.7f }, new[] { 4.34f, 1.2f, 1.6f, 0.98f }, new[] { 6.85f, 1.4f, 1.2f, 1.1f }, new[] { 5.45f, 0.2f, 2f, 1.25f },
            new[] { 3.95f, -0.18f, 1.6f, 0.95f }, new[] { 7.19f, -0.18f, 1.6f, 0.95f }, new[] { 5.45f, -0.33f, 1.9f, 0.65f }, new[] { 4.15f, -0.93f, 0.9f, 0.85f },
            new[] { 7.39f, 0.93f, 0.9f, 0.85f }, new[] { 5.57f, -1.63f, 1.6f, 0.95f }, new[] { 5.57f, -2.93f, 1.6f, 0.96f },
            new[] { 3.95f, -2.94f, 1.6f, 1.45f }, new[] { 7.19f, -2.94f, 1.6f, 1.45f }
        };

        for (int i = 0; i < Account.CurrentAccount.GetCurrentHero().EquippedItems.Length; i++)
        {
            if (Account.CurrentAccount.GetCurrentHero().EquippedItems[i] != null)
            {
                string pathToQualityBackground = "";
                switch (Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Quality)
                {
                case ItemQuality.Rare:
                    pathToQualityBackground = Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Size == 2
                            ? "Borders/InGame/Inventory/Quality_Large_Equip_Rare"
                            : "Borders/InGame/Inventory/Quality_Small_Equip_Rare";
                    break;

                case ItemQuality.Legendary:
                    pathToQualityBackground = Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Size == 2
                            ? "Borders/InGame/Inventory/Quality_Large_Equip_Legendary"
                            : "Borders/InGame/Inventory/Quality_Small_Inventory_Legendary";
                    break;

                case ItemQuality.Set:
                    pathToQualityBackground = Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Size == 2
                            ? "Borders/InGame/Inventory/Quality_Large_Equip_Set"
                            : "Borders/InGame/Inventory/Quality_Small_Inventory_Set";
                    break;
                }
                var qualityGameObject = StaticScripts.CreateGameObj(string.Format("EquippedItem_{0}", i), pathToQualityBackground, new Vector3(coordinates[i][2], coordinates[i][3]),
                                                                    new Vector3(coordinates[i][0], coordinates[i][1]), true, 1, true, typeof(ShowTooltipScript), true, name, 3);
                qualityGameObject.GetComponent <ShowTooltipScript>().Item = Account.CurrentAccount.GetCurrentHero().EquippedItems[i];

                if (Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Name != null)
                {
                    if (Resources.Load <Texture2D>(string.Format(@"Items/{0}/{0}_{1}", Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Type,
                                                                 Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Name.Replace(" ", "_"))))
                    {
                        StaticScripts.CreateGameObj(string.Format("EquippedItem_{0}_icon", i), string.Format(@"Items/{0}/{0}_{1}",
                                                                                                             Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Type, Account.CurrentAccount.GetCurrentHero().EquippedItems[i].Name.Replace(" ", "_")),
                                                    new Vector3(0.9f, 0.9f), new Vector3(0.03f, 0.03f), child: true, parentName: qualityGameObject.name, sortingOrder: 5);
                    }
                }
            }
        }
    }