Beispiel #1
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"));
    }
Beispiel #2
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));
    }
Beispiel #3
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"));
        }
    }
Beispiel #4
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");
        }
    }
    new void OnMouseUpAsButton()
    {
        if (_State == ButtonState.Disabled || _State == ButtonState.Selected)
        {
            return;
        }
        _State = ButtonState.Selected;

        var buttonText = GameObject.Find(gameObject.name + "Text");

        if (buttonText == null)
        {
            return;
        }
        buttonText.GetComponent <Renderer>().material.color = new Color32(255, 255, 255, 255);

        var classDetails   = GameObject.Find("ClassDetails");
        var classDetailTex = new Texture2D(0, 0);



        switch (gameObject.name.Replace("Button", string.Empty).Replace(" ", string.Empty))
        {
        case "Barbarian":
            classDetailTex = Resources.Load <Texture2D>(@"Borders/CharacterCreation/BattleNetHeroCreate_DetailsBarbarian");
            Account.CurrentAccount.GetCurrentHero().Class =
                GameClasses.Barbarian;
            break;

        case "Crusader":
            classDetailTex =
                Resources.Load <Texture2D>(@"Borders/CharacterCreation/BattleNetHeroCreate_DetailsCrusader");
            Account.CurrentAccount.GetCurrentHero().Class =
                GameClasses.Crusader;
            break;

        case "DemonHunter":
            classDetailTex =
                Resources.Load <Texture2D>(@"Borders/CharacterCreation/BattleNetHeroCreate_DetailsDemonHunter");
            Account.CurrentAccount.GetCurrentHero().Class =
                GameClasses.DemonHunter;
            break;

        case "Monk":
            classDetailTex =
                Resources.Load <Texture2D>(@"Borders/CharacterCreation/BattleNetHeroCreate_DetailsMonk");
            Account.CurrentAccount.GetCurrentHero().Class =
                GameClasses.Monk;
            break;

        case "WitchDoctor":
            classDetailTex =
                Resources.Load <Texture2D>(@"Borders/CharacterCreation/BattleNetHeroCreate_DetailsWitchDoctor");
            Account.CurrentAccount.GetCurrentHero().Class =
                GameClasses.WitchDoctor;
            break;

        case "Wizard":
            classDetailTex =
                Resources.Load <Texture2D>(@"Borders/CharacterCreation/BattleNetHeroCreate_DetailsWizard");
            Account.CurrentAccount.GetCurrentHero().Class =
                GameClasses.Wizard;
            break;
        }
        classDetails.GetComponent <SpriteRenderer>().sprite = Sprite.Create(classDetailTex,
                                                                            new Rect(0, 0, classDetailTex.width, classDetailTex.height), new Vector2(0, 0));

        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"));


        foreach (var s in classesArray)
        {
            var obj = GameObject.Find(string.Format("{0}Button", s));
            if (obj == null || obj == gameObject)
            {
                continue;
            }
            if (obj.GetComponent <SpriteRenderer>().sprite.texture.name != "BattleNetButton_ClearSelected_397x66")
            {
                continue;
            }
            obj.GetComponent <ButtonBaseMouseEvents>()._State = ButtonState.Up;

            var buttonUpText = GameObject.Find(obj.name + "Text");
            if (buttonUpText == null)
            {
                return;
            }
            buttonUpText.GetComponent <Renderer>().material.color = new Color32(243, 170, 85, 255);
        }
    }