Beispiel #1
0
    public void loadInfoTower(STowerID ID)
    {
        if (target != null)
        {
            TowerShopController towerShopController = target.GetComponent <TowerShopController>();
            if (towerShopController.ID != ID)
            {
                towerShopController.setColor(false);
            }
            else
            {
                return;
            }
        }

        foreach (Transform child in towerShopPanel.transform)
        {
            TowerShopController towerShopController = child.GetComponent <TowerShopController>();
            if (towerShopController != null)
            {
                if (towerShopController.ID == ID)
                {
                    target = towerShopController.gameObject;
                    ShopController.Instance.target.GetComponent <TowerShopController>().setColor(true);

                    loadInfoTower();
                    break;
                }
            }
        }
    }
    public void setValueInfo(STowerID ID, string strDescribe)
    {
        //Icon
        object[] value = PlayConfig.getBulletBuild(ID);
        SAnchor  b     = (SAnchor)value[1];

        object[] bulletData = PlayConfig.getBulletShop(ID);
        goldIcon.mainTexture     = Resources.Load <Texture>(GameConfig.PathBulletIcon + bulletData[0]);
        goldIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
        goldIcon.SetDimensions(goldIcon.mainTexture.width, goldIcon.mainTexture.height);
        goldIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

        UIAnchor anchor = goldIcon.GetComponent <UIAnchor>();

        anchor.relativeOffset = b.Anchor;
        anchor.enabled        = true;

        UIStretch stretch = goldIcon.GetComponent <UIStretch>();

        stretch.relativeSize.y = b.Stretch;
        stretch.enabled        = true;
//


        //Label
        //string[] str = PlayConfig.getBulletType(s);

        goldAbility.text = strDescribe;


        goldEffect.gameObject.SetActive(false);
    }
    public void setNextHouseIcon(STowerID id)
    {
        if (isLock)
        {
            lockUpgrade(false);
            isLock = false;
        }

        string s = GameConfig.PathHouseIcon + id.Level;

        upgradeIcon.mainTexture = Resources.Load <Texture>(s);

        UITexture texture = upgradeIcon.GetComponent <UITexture>();

        texture.keepAspectRatio = UIWidget.AspectRatioSource.Free;
        Vector2 localSize = new Vector2(texture.mainTexture.width, texture.mainTexture.height);

        texture.SetDimensions((int)localSize.x, (int)localSize.y);
        texture.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

        UIStretch uiStretch = upgradeIcon.GetComponent <UIStretch>();

        //uiStretch.container = panelTowerBuild.gameObject;
        uiStretch.enabled = true;
    }
    public void setBulletInfo(STowerID ID, string s, GameObject bullet)
    {
        //Icon
        object[] value = PlayConfig.getBulletBuild(ID);
        SAnchor  b     = (SAnchor)value[1];

        bulletIcon.mainTexture     = Resources.Load <Texture>(GameConfig.PathBulletIcon + value[0].ToString());
        bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
        bulletIcon.SetDimensions(bulletIcon.mainTexture.width, bulletIcon.mainTexture.height);
        bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

        UIAnchor anchor = bulletIcon.GetComponent <UIAnchor>();

        anchor.relativeOffset = b.Anchor;
        anchor.enabled        = true;

        UIStretch stretch = bulletIcon.GetComponent <UIStretch>();

        stretch.relativeSize.y = b.Stretch;
        stretch.enabled        = true;

        //Label
        string[] str = PlayConfig.getBulletType(s);
        bulletAbility.text = str[0] + " TARGET";
        bulletRegion.text  = str[1];

        //Bullet effect
        if (bullet != null)
        {
            BulletController bulletController = bullet.GetComponent <BulletController>();
            if (bulletController.effect == EBulletEffect.NONE)
            {
                bulletEffect.gameObject.SetActive(false);
            }
            else
            {
                bulletEffect.gameObject.SetActive(true);
                bulletEffect.GetComponent <UIPlay>().bulletEffect = bullet;
                bulletEffect.spriteName = "icon-effect-" + bullet.GetComponent <BulletController>().effect.ToString().ToLower();
            }
            bulletEffect.GetComponent <UIPlay>().bulletEffect = bullet;
        }
    }
    public static Color[] getColorTowerName(STowerID ID)
    {
        Color[] colors = new Color[2];
        switch (ID.Type)
        {
        case ETower.ARCHITECT:
            colors[0] = PlayConfig.ColorTowerArchitect;
            colors[1] = PlayConfig.ColorTowerArchitectOutline;
            break;

        case ETower.ROCK:
            colors[0] = PlayConfig.ColorTowerRock;
            colors[1] = PlayConfig.ColorTowerRockOutline;
            break;

        case ETower.ICE:
            colors[0] = PlayConfig.ColorTowerIce;
            colors[1] = PlayConfig.ColorTowerIceOutline;
            break;

        case ETower.FIRE:
            colors[0] = PlayConfig.ColorTowerFire;
            colors[1] = PlayConfig.ColorTowerFireOutline;
            break;

        case ETower.GOLD:
            colors[0] = PlayConfig.ColorTowerGold;
            colors[1] = PlayConfig.ColorTowerGoldOutline;
            break;

        case ETower.POISON:
            colors[0] = PlayConfig.ColorTowerPoison;
            colors[1] = PlayConfig.ColorTowerPoisonOutline;
            break;
        }
        return(colors);
    }
    public void setNextHouseIcon(STowerID id)
    {
        if (isLock)
        {
            lockUpgrade(false);
            isLock = false;
        }

        string s = GameConfig.PathHouseIcon + id.Level;

        upgradeIcon.mainTexture = Resources.Load<Texture>(s);

        UITexture texture = upgradeIcon.GetComponent<UITexture>();
        texture.keepAspectRatio = UIWidget.AspectRatioSource.Free;
        Vector2 localSize = new Vector2(texture.mainTexture.width, texture.mainTexture.height);
        texture.SetDimensions((int)localSize.x, (int)localSize.y);
        texture.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

        UIStretch uiStretch = upgradeIcon.GetComponent<UIStretch>();
        //uiStretch.container = panelTowerBuild.gameObject;
        uiStretch.enabled = true;
    }
	public void setBulletInfo(STowerID ID, string s, GameObject bullet)
	{
		//Icon
		object[] value = PlayConfig.getBulletBuild(ID);
        SAnchor b = (SAnchor)value[1];

		bulletIcon.mainTexture = Resources.Load<Texture>(GameConfig.PathBulletIcon + value[0].ToString());
		bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
        bulletIcon.SetDimensions(bulletIcon.mainTexture.width, bulletIcon.mainTexture.height);
		bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

		UIAnchor anchor = bulletIcon.GetComponent<UIAnchor>();
		anchor.relativeOffset = b.Anchor;
		anchor.enabled = true;

		UIStretch stretch = bulletIcon.GetComponent<UIStretch>();
		stretch.relativeSize.y = b.Stretch;
		stretch.enabled = true;

		//Label
		string[] str = PlayConfig.getBulletType(s);
		bulletAbility.text = str[0] + " TARGET";
		bulletRegion.text = str[1];

		//Bullet effect
		if (bullet != null)
		{
			BulletController bulletController = bullet.GetComponent<BulletController>();
			if (bulletController.effect == EBulletEffect.NONE)
				bulletEffect.gameObject.SetActive(false);
			else
			{
				bulletEffect.gameObject.SetActive(true);
				bulletEffect.GetComponent<UIPlay>().bulletEffect = bullet;
				bulletEffect.spriteName = "icon-effect-" + bullet.GetComponent<BulletController>().effect.ToString().ToLower();
			}
			bulletEffect.GetComponent<UIPlay>().bulletEffect = bullet;
		}
	}
Beispiel #8
0
    public void loadInfoTowerPassive()
    {
        if (target != null)
        {
            //AutoDestroy.destroyChildren(infoPanel, PlayNameHashIDs.Collider);

            //active tower name
            if (!labelTowerName.gameObject.activeSelf)
            {
                labelTowerName.gameObject.SetActive(true);
            }

            TowerShopController targetController = target.GetComponent <TowerShopController>();
            labelTowerName.text = targetController.Name.text.ToUpper() + " TOWER";

            //Set towe name color
            Color[] nameColor = PlayConfig.getColorTowerName(targetController.ID);
            labelTowerName.color       = nameColor[0];
            labelTowerName.effectColor = nameColor[1];

            STowerID towerID = targetController.ID;

            GameObject[] towersPassive = ObjectManager.Instance.TowersPassive;
            int          length        = towersPassive.Length;
            int          count         = 0;

            for (int i = 0; i < length; i++)
            {
                TowerPassiveController towerController = towersPassive[i].GetComponent <TowerPassiveController>();

                if (towerController.ID.Type == towerID.Type && towerController.ID.Level == towerID.Level)
                {
                    while (true)
                    {
                        GameObject info = Instantiate(towerInfoModel) as GameObject;
                        info.transform.parent     = infoPanel.transform;
                        info.transform.localScale = Vector3.one;
                        info.name = towerController.name;

                        UIAnchor anchor = info.GetComponent <UIAnchor>();
                        anchor.container      = infoPanel.gameObject;
                        anchor.relativeOffset = new Vector2(0, PlayConfig.InfoShopAnchor.PanelAnchorStart - count * PlayConfig.InfoShopAnchor.PanelAnchorDistance);

                        #region TOWER
                        TowerShopInfoController infoController = info.GetComponent <TowerShopInfoController>();
                        infoController.icon.mainTexture = Resources.Load <Texture>(PlayConfig.getTowerIcon(towerID));
                        infoController.level.text       = "Level " + ((int)towerID.Level).ToString();
                        infoController.atk.text         = towerController.attribute.MinATK.ToString() + " - " + towerController.attribute.MaxATK.ToString();
                        infoController.spawnShoot.text  = towerController.attribute.SpawnShoot.ToString();
                        infoController.timeBuild.text   = towerController.attribute.TimeBuild.ToString();

                        //Bullet label
                        string[] str = PlayConfig.getBulletType(towerController.attackType.ToString());
                        infoController.bulletAbility.text = str[0] + " TARGET";
                        infoController.bulletRegion.text  = str[1];

                        //set icon fix size
                        infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
                        Vector2 localSize = new Vector2(infoController.icon.mainTexture.width, infoController.icon.mainTexture.height);
                        infoController.icon.SetDimensions((int)localSize.x, (int)localSize.y);
                        infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

                        UIStretch uiStretch = infoController.icon.GetComponent <UIStretch>();
                        uiStretch.enabled = true;
                        #endregion

                        #region BULLET
                        object[] bulletData      = PlayConfig.getBulletShop(towerID);
                        SAnchor  bulletTowerShop = (SAnchor)bulletData[1];
                        infoController.bulletIcon.mainTexture = Resources.Load <Texture>("Image/Bullet/Bullet Icon/" + bulletData[0].ToString());

                        infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
                        infoController.bulletIcon.SetDimensions(infoController.bulletIcon.mainTexture.width, infoController.bulletIcon.mainTexture.height);
                        infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

                        UIStretch stretch = infoController.bulletIcon.GetComponent <UIStretch>();
                        stretch.relativeSize.y = bulletTowerShop.Stretch;
                        stretch.enabled        = true;

                        //Add effect
                        infoController.bullet = towerController.bullet;
                        #endregion

                        count++;

                        //get Next Tower
                        if (towerController.nextLevel != null)
                        {
                            towerID         = towerController.nextLevel.GetComponent <TowerPassiveController>().ID;
                            towerController = towerController.nextLevel as TowerPassiveController;
                        }
                        else
                        {
                            break;
                        }
                    }
                    break;
                }
            }
        }
    }
    public static object[] getBulletBuild(STowerID id)
    {
        SAnchor config = new SAnchor(Vector2.zero, 1);

        string s = "bullet-";

        switch (id.Type)
        {
            #region ARCHITECT
        case ETower.ARCHITECT:
            s += "architect";
            switch (id.Level)
            {
            case 1:
                config = PlayConfig.BuildBulletArchitect1;
                break;

            case 2:
                config = PlayConfig.BuildBulletArchitect2;
                break;

            case 3:
                config = PlayConfig.BuildBulletArchitect3;
                break;
            }
            break;

            #endregion
            #region ROCK
        case ETower.ROCK:
            s += "rock";
            switch (id.Level)
            {
            case 1:
                config = PlayConfig.BuildBulletRock1;
                break;

            case 2:
                config = PlayConfig.BuildBulletRock2;
                break;

            case 3:
                config = PlayConfig.BuildBulletRock3;
                break;
            }
            break;

            #endregion
            #region ICE
        case ETower.ICE:
            s += "ice";
            switch (id.Level)
            {
            case 1:
                config = PlayConfig.BuildBulletIce1;
                break;

            case 2:
                config = PlayConfig.BuildBulletIce2;
                break;

            case 3:
                config = PlayConfig.BuildBulletIce3;
                break;
            }
            break;

            #endregion
            #region FIRE
        case ETower.FIRE:
            s += "fire";
            switch (id.Level)
            {
            case 1:
                config = PlayConfig.BuildBulletFire1;
                break;

            case 2:
                config = PlayConfig.BuildBulletFire2;
                break;

            case 3:
                config = PlayConfig.BuildBulletFire3;
                break;
            }
            break;

            #endregion
            #region POISON
        case ETower.POISON:
            s += "poison";
            switch (id.Level)
            {
            case 1:
                config = PlayConfig.BuildBulletPoison1;
                break;

            case 2:
                config = PlayConfig.BuildBulletPoison2;
                break;

            case 3:
                config = PlayConfig.BuildBulletPoison3;
                break;
            }
            break;

            #endregion
            #region POISON
        case ETower.GOLD:
            s += "GOLD";
            switch (id.Level)
            {
            case 1:
                config = PlayConfig.BuildBulletGold;
                break;

            case 2:
                config = PlayConfig.BuildBulletGold;
                break;

            case 3:
                config = PlayConfig.BuildBulletGold;
                break;
            }
            break;
            #endregion
        }
        s += "-" + id.Level.ToString();
        return(new object[] { s, config });
    }
	public static Color[] getColorTowerName(STowerID ID)
	{
		Color[] colors = new Color[2];
		switch (ID.Type)
		{
			case ETower.ARCHITECT:
				colors[0] = PlayConfig.ColorTowerArchitect;
				colors[1] = PlayConfig.ColorTowerArchitectOutline;
				break;
			case ETower.ROCK:
				colors[0] = PlayConfig.ColorTowerRock;
				colors[1] = PlayConfig.ColorTowerRockOutline;
				break;
			case ETower.ICE:
				colors[0] = PlayConfig.ColorTowerIce;
				colors[1] = PlayConfig.ColorTowerIceOutline;
				break;
			case ETower.FIRE:
				colors[0] = PlayConfig.ColorTowerFire;
				colors[1] = PlayConfig.ColorTowerFireOutline;
				break;
            case ETower.GOLD:
                colors[0] = PlayConfig.ColorTowerGold;
                colors[1] = PlayConfig.ColorTowerGoldOutline;
                break;
            case ETower.POISON:
                colors[0] = PlayConfig.ColorTowerPoison;
                colors[1] = PlayConfig.ColorTowerPoisonOutline;
                break;
		}
		return colors;
	}
 public static string getTowerIcon(STowerID towerID)
 {
     return(GameConfig.PathTowerIcon + towerID.Type.ToString() + "-" + towerID.Level);
 }
	public void setValueInfo(STowerID ID, string strDescribe)
	{
		//Icon
		object[] value = PlayConfig.getBulletBuild(ID);
        SAnchor b = (SAnchor)value[1];
		object[] bulletData = PlayConfig.getBulletShop(ID);
		goldIcon.mainTexture = Resources.Load<Texture>(GameConfig.PathBulletIcon + bulletData[0]);
		goldIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
		goldIcon.SetDimensions(goldIcon.mainTexture.width, goldIcon.mainTexture.height);
		goldIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;
		
		UIAnchor anchor = goldIcon.GetComponent<UIAnchor>();
		anchor.relativeOffset = b.Anchor;
		anchor.enabled = true;
		
		UIStretch stretch = goldIcon.GetComponent<UIStretch>();
		stretch.relativeSize.y = b.Stretch;
		stretch.enabled = true;
//


		//Label
		//string[] str = PlayConfig.getBulletType(s);

		goldAbility.text = strDescribe;


		goldEffect.gameObject.SetActive(false);
	
	}
	public static object[] getBulletBuild(STowerID id)
	{
        SAnchor config = new SAnchor(Vector2.zero, 1);

		string s = "bullet-";
		switch (id.Type)
		{
			#region ARCHITECT
			case ETower.ARCHITECT:
				s += "architect";
				switch (id.Level)
				{
					case 1:
						config = PlayConfig.BuildBulletArchitect1;
						break;
					case 2:
						config = PlayConfig.BuildBulletArchitect2;
						break;
					case 3:
						config = PlayConfig.BuildBulletArchitect3;
						break;
				}
				break;
			#endregion
			#region ROCK
			case ETower.ROCK:
				s += "rock";
				switch (id.Level)
				{
					case 1:
						config = PlayConfig.BuildBulletRock1;
						break;
					case 2:
						config = PlayConfig.BuildBulletRock2;
						break;
					case 3:
						config = PlayConfig.BuildBulletRock3;
						break;
				}
				break;
			#endregion
			#region ICE
			case ETower.ICE:
				s += "ice";
				switch (id.Level)
				{
					case 1:
						config = PlayConfig.BuildBulletIce1;
						break;
					case 2:
						config = PlayConfig.BuildBulletIce2;
						break;
					case 3:
						config = PlayConfig.BuildBulletIce3;
						break;
				}
				break;
			#endregion
			#region FIRE
			case ETower.FIRE:
				s += "fire";
				switch (id.Level)
				{
					case 1:
						config = PlayConfig.BuildBulletFire1;
						break;
					case 2:
						config = PlayConfig.BuildBulletFire2;
						break;
					case 3:
						config = PlayConfig.BuildBulletFire3;
						break;
				}
				break;
			#endregion
            #region POISON
            case ETower.POISON:
                s += "poison";
                switch (id.Level)
                {
                    case 1:
                        config = PlayConfig.BuildBulletPoison1;
                        break;
                    case 2:
                        config = PlayConfig.BuildBulletPoison2;
                        break;
                    case 3:
                        config = PlayConfig.BuildBulletPoison3;
                        break;
                }
                break;
            #endregion
			#region POISON
		case ETower.GOLD:
			s += "GOLD";
			switch (id.Level)
			{
			case 1:
				config = PlayConfig.BuildBulletGold;
				break;
			case 2:
				config = PlayConfig.BuildBulletGold;
				break;
			case 3:
				config = PlayConfig.BuildBulletGold;
				break;
			}
			break;
			#endregion
		}
		s += "-" + id.Level.ToString();
		return new object[] { s, config };
	}
	public static object[] getBulletShop(STowerID id)
	{
        float stretch = -1;
		string s = "bullet-";
		switch (id.Type)
		{
			#region ARCHITECT
			case ETower.ARCHITECT:
				s += "architect";
				switch (id.Level)
				{
					case 1:
                        stretch = PlayConfig.StretchShopBulletArchitect1;
						break;
					case 2:
                        stretch = PlayConfig.StretchShopBulletArchitect2;
						break;
					case 3:
                        stretch = PlayConfig.StretchShopBulletArchitect3;
						break;
				}
				break;
			#endregion
			#region ROCK
			case ETower.ROCK:
				s += "rock";
				switch (id.Level)
				{
                    case 1:
                        stretch = PlayConfig.StretchShopBulletRock1;
                        break;
                    case 2:
                        stretch = PlayConfig.StretchShopBulletRock2;
                        break;
                    case 3:
                        stretch = PlayConfig.StretchShopBulletRock3;
                        break;
				}
				break;
			#endregion
			#region ICE
			case ETower.ICE:
				s += "ice";
				switch (id.Level)
				{
                    case 1:
                        stretch = PlayConfig.StretchShopBulletIce1;
                        break;
                    case 2:
                        stretch = PlayConfig.StretchShopBulletIce2;
                        break;
                    case 3:
                        stretch = PlayConfig.StretchShopBulletIce3;
                        break;
				}
				break;
			#endregion
			#region FIRE
			case ETower.FIRE:
				s += "fire";
				switch (id.Level)
				{
                    case 1:
                        stretch = PlayConfig.StretchShopBulletFire1;
                        break;
                    case 2:
                        stretch = PlayConfig.StretchShopBulletFire2;
                        break;
                    case 3:
                        stretch = PlayConfig.StretchShopBulletFire3;
                        break;
				}
				break;
#endregion
            #region POISON
            case ETower.POISON:
                s += "poison";
                switch (id.Level)
                {
                    case 1:
                        stretch = PlayConfig.StretchShopBulletPoison1;
                        break;
                    case 2:
                        stretch = PlayConfig.StretchShopBulletPoison2;
                        break;
                    case 3:
                        stretch = PlayConfig.StretchShopBulletPoison3;
                        break;
                }
                break;
			#endregion
			#region POISON
		case ETower.GOLD:
			s += "gold";
			switch (id.Level)
			{
			case 1:
				stretch = PlayConfig.StretchShopBulletGold;
				break;
			case 2:
				stretch = PlayConfig.StretchShopBulletGold;
				break;
			case 3:
				stretch = PlayConfig.StretchShopBulletGold;
				break;
			}
			break;
			#endregion
		}
		s += "-" + id.Level.ToString();
        return new object[] { s, stretch };
	}
	public static string getTowerIcon(STowerID towerID)
	{
		return (GameConfig.PathTowerIcon + towerID.Type.ToString() + "-" + towerID.Level);
	}
    public static object[] getBulletShop(STowerID id)
    {
        float  stretch = -1;
        string s       = "bullet-";

        switch (id.Type)
        {
            #region ARCHITECT
        case ETower.ARCHITECT:
            s += "architect";
            switch (id.Level)
            {
            case 1:
                stretch = PlayConfig.StretchShopBulletArchitect1;
                break;

            case 2:
                stretch = PlayConfig.StretchShopBulletArchitect2;
                break;

            case 3:
                stretch = PlayConfig.StretchShopBulletArchitect3;
                break;
            }
            break;

            #endregion
            #region ROCK
        case ETower.ROCK:
            s += "rock";
            switch (id.Level)
            {
            case 1:
                stretch = PlayConfig.StretchShopBulletRock1;
                break;

            case 2:
                stretch = PlayConfig.StretchShopBulletRock2;
                break;

            case 3:
                stretch = PlayConfig.StretchShopBulletRock3;
                break;
            }
            break;

            #endregion
            #region ICE
        case ETower.ICE:
            s += "ice";
            switch (id.Level)
            {
            case 1:
                stretch = PlayConfig.StretchShopBulletIce1;
                break;

            case 2:
                stretch = PlayConfig.StretchShopBulletIce2;
                break;

            case 3:
                stretch = PlayConfig.StretchShopBulletIce3;
                break;
            }
            break;

            #endregion
            #region FIRE
        case ETower.FIRE:
            s += "fire";
            switch (id.Level)
            {
            case 1:
                stretch = PlayConfig.StretchShopBulletFire1;
                break;

            case 2:
                stretch = PlayConfig.StretchShopBulletFire2;
                break;

            case 3:
                stretch = PlayConfig.StretchShopBulletFire3;
                break;
            }
            break;

            #endregion
            #region POISON
        case ETower.POISON:
            s += "poison";
            switch (id.Level)
            {
            case 1:
                stretch = PlayConfig.StretchShopBulletPoison1;
                break;

            case 2:
                stretch = PlayConfig.StretchShopBulletPoison2;
                break;

            case 3:
                stretch = PlayConfig.StretchShopBulletPoison3;
                break;
            }
            break;

            #endregion
            #region POISON
        case ETower.GOLD:
            s += "gold";
            switch (id.Level)
            {
            case 1:
                stretch = PlayConfig.StretchShopBulletGold;
                break;

            case 2:
                stretch = PlayConfig.StretchShopBulletGold;
                break;

            case 3:
                stretch = PlayConfig.StretchShopBulletGold;
                break;
            }
            break;
            #endregion
        }
        s += "-" + id.Level.ToString();
        return(new object[] { s, stretch });
    }
    public void loadTowerInfo()
    {
        ;
        if (target != null)
        {
            AutoDestroy.destroyChildren(infoTower, "Level");

            //clear array
            listTower.Clear();

            //active tower name
            if (!infoName.gameObject.activeSelf)
            {
                infoName.gameObject.SetActive(true);
            }

            TowerGuideController targetController = target.GetComponentInChildren <TowerGuideController>();
            string name = targetController.ID.Type.ToString();
            infoName.text = name[0] + name.Substring(1, name.Length - 1).ToLower() + " LV " + targetController.ID.Level;

            //Set towe name color
            Color[] nameColor = PlayConfig.getColorTowerName(targetController.ID);
            infoName.color       = nameColor[0];
            infoName.effectColor = nameColor[1];

            STowerID towerID = targetController.ID;

            GameObject[] towers = ObjectManager.Instance.Towers;
            int          length = towers.Length;
            int          count  = 0;
            for (int i = 0; i < length; i++)
            {
                TowerController towerController = towers[i].GetComponent <TowerController>();
                if (towerController.ID.Type == towerID.Type && towerController.ID.Level == towerID.Level)
                {
                    while (true)
                    {
                        GameObject info = Instantiate(PlayManager.Instance.modelPlay.TowerGuideInfo) as GameObject;
                        info.transform.parent     = infoTower.transform;
                        info.transform.localScale = Vector3.one;
                        info.name = towerController.name;

                        UIAnchor anchor = info.GetComponent <UIAnchor>();
                        anchor.container      = InfoPanel.gameObject;
                        anchor.relativeOffset = new Vector2(PlayConfig.AnchorTowerGuideInfoStartX + count * PlayConfig.AnchorTowerGuideInfoDistance, PlayConfig.AnchorTowerGuideInfoStartY);

                        #region TOWER
                        TowerShopInfoController infoController = info.GetComponent <TowerShopInfoController>();
                        infoController.icon.mainTexture = Resources.Load <Texture>(PlayConfig.getTowerIcon(towerID));
                        infoController.level.text       = "Level " + ((int)towerID.Level).ToString();

                        infoController.atk.parent.transform.GetComponentInChildren <UISprite> ().spriteName = "icon-atk";
                        infoController.atk.text        = towerController.attribute.MinATK.ToString() + " - " + towerController.attribute.MaxATK.ToString();
                        infoController.spawnShoot.text = towerController.attribute.SpawnShoot.ToString();
                        infoController.timeBuild.text  = towerController.attribute.TimeBuild.ToString();

                        //Bullet label
                        string[] str = PlayConfig.getBulletType(towerController.attackType.ToString());
                        infoController.bulletAbility.text = str[0] + " TARGET";
                        infoController.bulletRegion.text  = str[1];

                        //set icon fix size
                        infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
                        infoController.icon.SetDimensions(infoController.icon.mainTexture.width, infoController.icon.mainTexture.height);
                        infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

                        UIStretch uiStretch = infoController.icon.GetComponent <UIStretch>();
                        uiStretch.enabled = true;
                        #endregion

                        #region BULLET
                        object[] bulletData = PlayConfig.getBulletShop(towerID);
                        infoController.bulletIcon.mainTexture     = Resources.Load <Texture>("Image/Bullet/Bullet Icon/" + bulletData[0].ToString());
                        infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
                        infoController.bulletIcon.SetDimensions(infoController.bulletIcon.mainTexture.width, infoController.bulletIcon.mainTexture.height);
                        infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

                        UIStretch stretch = infoController.bulletIcon.GetComponent <UIStretch>();
                        stretch.relativeSize.y = (float)bulletData[1];
                        stretch.enabled        = true;

                        //Add effect
                        infoController.bullet = towerController.bullet;
                        #endregion

                        count++;
                        listTower.Add(info);

                        //get Next Tower
                        if (towerController.nextLevel != null)
                        {
                            towerID         = towerController.nextLevel.GetComponent <TowerController>().ID;
                            towerController = towerController.nextLevel;
                        }
                        else
                        {
                            maxLevel     = count;
                            currentLevel = 1;
                            towerLevelSelected.transform.position = levels[currentLevel - 1].transform.position;
                            break;
                        }
                    }
                    break;
                }
            }

            towers = ObjectManager.Instance.TowersPassive;
            length = towers.Length;
            for (int i = 0; i < length; i++)
            {
                TowerPassiveController towerController = towers[i].GetComponent <TowerPassiveController>();
                if (towerController.ID.Type == towerID.Type && towerController.ID.Level == towerID.Level)
                {
                    while (true)
                    {
                        GameObject info = Instantiate(PlayManager.Instance.modelPlay.TowerGuideInfo) as GameObject;
                        info.transform.parent     = infoTower.transform;
                        info.transform.localScale = Vector3.one;
                        info.name = towerController.name;

                        UIAnchor anchor = info.GetComponent <UIAnchor>();
                        anchor.container      = InfoPanel.gameObject;
                        anchor.relativeOffset = new Vector2(PlayConfig.AnchorTowerGuideInfoStartX + count * PlayConfig.AnchorTowerGuideInfoDistance, PlayConfig.AnchorTowerGuideInfoStartY);

                        #region TOWER
                        TowerShopInfoController infoController = info.GetComponent <TowerShopInfoController>();
                        infoController.icon.mainTexture = Resources.Load <Texture>(PlayConfig.getTowerIcon(towerID));
                        infoController.level.text       = "Level " + ((int)towerID.Level).ToString();

                        infoController.atk.parent.transform.GetComponentInChildren <UISprite> ().spriteName = "icon-gold";
                        infoController.atk.text        = towerController.passiveAttribute.Value.ToString();
                        infoController.spawnShoot.text = towerController.passiveAttribute.UpdateTime.ToString();
                        infoController.timeBuild.text  = towerController.passiveAttribute.TimeBuild.ToString();

                        //Bullet label
                        //string[] str = PlayConfig.getBulletType(towerController.attackType.ToString());
                        infoController.bulletAbility.text = towerController.passiveAttribute.Describe.ToString();
                        infoController.bulletRegion.text  = towerController.passiveAttribute.Type.ToString();;

                        //set icon fix size
                        infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
                        infoController.icon.SetDimensions(infoController.icon.mainTexture.width, infoController.icon.mainTexture.height);
                        infoController.icon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

                        UIStretch uiStretch = infoController.icon.GetComponent <UIStretch>();
                        uiStretch.enabled = true;
                        #endregion

                        #region BULLET
                        object[] bulletData = PlayConfig.getBulletShop(towerID);
                        infoController.bulletIcon.mainTexture     = Resources.Load <Texture>("Image/Bullet/Bullet Icon/" + bulletData[0].ToString());
                        infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.Free;
                        infoController.bulletIcon.SetDimensions(infoController.bulletIcon.mainTexture.width, infoController.bulletIcon.mainTexture.height);
                        infoController.bulletIcon.keepAspectRatio = UIWidget.AspectRatioSource.BasedOnHeight;

                        UIStretch stretch = infoController.bulletIcon.GetComponent <UIStretch>();
                        stretch.relativeSize.y = (float)bulletData[1];
                        stretch.enabled        = true;

                        //Add effect

                        infoController.bullet = towerController.bullet;
                        #endregion

                        count++;
                        listTower.Add(info);

                        //get Next Tower
                        if (towerController.nextLevel != null)
                        {
                            towerID         = towerController.nextLevel.GetComponent <TowerPassiveController>().ID;
                            towerController = (TowerPassiveController)towerController.nextLevel;
                        }
                        else
                        {
                            maxLevel     = count;
                            currentLevel = 1;
                            towerLevelSelected.transform.position = levels[currentLevel - 1].transform.position;
                            break;
                        }
                    }
                    break;
                }
            }
        }
    }