Example #1
0
    public void createSenpouStatusView(string busyoId)
    {
        StatusGet sts         = new StatusGet();
        ArrayList senpouArray = sts.getOriginalSenpou(int.Parse(busyoId), false);

        int    senpouId     = (int)senpouArray[0];
        string senpouTyp    = senpouArray[1].ToString();
        string senpouName   = senpouArray[2].ToString();
        string senpouExp    = senpouArray[3].ToString();
        float  senpouEach   = (float)senpouArray[4];
        float  senpouRatio  = (float)senpouArray[5];
        float  senpouTerm   = (float)senpouArray[6];
        int    senpouStatus = (int)senpouArray[7];
        int    senpouLv     = (int)senpouArray[8];

        //Kahou Adjustment
        KahouStatusGet kahouSts = new KahouStatusGet();

        string[] KahouSenpouArray = kahouSts.getKahouForSenpou(busyoId, senpouStatus);
        string   kahouTyp         = KahouSenpouArray [0];
        string   adjSenpouStatus  = senpouStatus.ToString();

        if (kahouTyp != null)
        {
            if (kahouTyp == "Attack")
            {
                int kahouStatus = int.Parse(KahouSenpouArray [1]);
                adjSenpouStatus = adjSenpouStatus + "<color=#35d74bFF>(+" + kahouStatus.ToString() + ")</color>";
            }
            else
            {
                Debug.Log("Not Yet except for Attack");
            }
        }

        //Explanation Modification
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouExp.Replace("ABC", adjSenpouStatus);
            senpouExp = senpouExp.Replace("DEF", senpouEach.ToString());
            senpouExp = senpouExp.Replace("GHI", senpouRatio.ToString());
            senpouExp = senpouExp.Replace("JKL", senpouTerm.ToString());
        }
        else
        {
            senpouExp = senpouExp.Replace("A", adjSenpouStatus);
            senpouExp = senpouExp.Replace("B", senpouEach.ToString());
            senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
            senpouExp = senpouExp.Replace("D", senpouTerm.ToString());
        }
        //Fill fields by got Senpou Value
        GameObject.Find("SenpouValue").GetComponent <Text> ().text    = senpouName;
        GameObject.Find("SenpouLvValue").GetComponent <Text> ().text  = senpouLv.ToString();
        GameObject.Find("SenpouExpValue").GetComponent <Text> ().text = senpouExp;


        GameObject btn = GameObject.Find("SenpouStatus").transform.FindChild("ButtonHeihousyo").gameObject;

        if (senpouLv < 20)
        {
            btn.GetComponent <Image> ().color = OKClorBtn;
            btn.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
            btn.GetComponent <Button>().enabled = true;
        }
        else
        {
            btn.GetComponent <Image> ().color = NGClorBtn;
            btn.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
            btn.GetComponent <Button>().enabled = false;
        }
    }
Example #2
0
    public void OnClick()
    {
        if (Application.loadedLevelName != "tutorialHyojyo")
        {
            //Get Senryoku
            Senryoku Senryoku = null;
            foreach (Transform child in transform)
            {
                Senryoku = child.GetComponent <Senryoku>();
                busyoId  = int.Parse(child.name);
            }
            BusyoInfoGet BusyoInfoGet = new BusyoInfoGet();
            busyoName = BusyoInfoGet.getName(busyoId);
            hp        = Senryoku.totalHp;
            atk       = Senryoku.totalAtk;
            dfc       = Senryoku.totalDfc;
            spd       = Senryoku.totalSpd;
            daimyoId  = Senryoku.belongDaimyoId;
            lv        = Senryoku.lv;
            chQty     = Senryoku.chQty;
            heisyu    = BusyoInfoGet.getHeisyu(busyoId);
            sakuId    = BusyoInfoGet.getSakuId(busyoId);


            AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();
            audioSources[0].Play();

            string     pathOfBack = "Prefabs/Common/TouchBack";
            GameObject back       = Instantiate(Resources.Load(pathOfBack)) as GameObject;
            back.transform.parent        = GameObject.Find("Panel").transform;
            back.transform.localScale    = new Vector2(1, 1);
            back.transform.localPosition = new Vector2(0, 0);

            string     pathOfPop = "Prefabs/Jinkei/busyoDetail";
            GameObject pop       = Instantiate(Resources.Load(pathOfPop)) as GameObject;
            pop.transform.parent        = GameObject.Find("Panel").transform;
            pop.transform.localScale    = new Vector2(1, 1);
            pop.transform.localPosition = new Vector2(0, 0);

            //Kamon
            GameObject kamon     = pop.transform.FindChild("kamon").gameObject;
            string     imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
            kamon.GetComponent <Image>().sprite =
                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

            //Busyo Icon
            string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
            GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
            busyo.name = busyoId.ToString();
            busyo.transform.SetParent(pop.transform);
            busyo.transform.localScale = new Vector2(7, 7);
            busyo.GetComponent <DragHandler>().enabled = false;
            RectTransform busyoRect = busyo.GetComponent <RectTransform>();
            busyoRect.anchoredPosition3D = new Vector3(180, 400, 0);
            busyoRect.sizeDelta          = new Vector2(40, 40);
            busyo.transform.FindChild("Text").GetComponent <Text>().enabled = false;

            //Ship Rank
            string     shipPath = "Prefabs/Busyo/ShipSts";
            GameObject ShipObj  = Instantiate(Resources.Load(shipPath)) as GameObject;
            ShipObj.transform.SetParent(busyo.transform);
            preKaisen kaisenScript = new preKaisen();
            int       shipId       = kaisenScript.getShipSprite(ShipObj, busyoId);
            ShipObj.transform.localPosition = new Vector3(-10, -15, 0);
            ShipObj.transform.localScale    = new Vector2(0.2f, 0.2f);
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                if (shipId == 1)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "High";
                }
                else if (shipId == 2)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Mid";
                }
                else if (shipId == 3)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "Low";
                }
            }
            else
            {
                if (shipId == 1)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "上";
                }
                else if (shipId == 2)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "中";
                }
                else if (shipId == 3)
                {
                    ShipObj.transform.FindChild("Text").GetComponent <Text>().text = "下";
                }
            }

            //Name
            pop.transform.FindChild("busyoNameValue").GetComponent <Text>().text = busyoName;
            pop.transform.FindChild("lvValue").GetComponent <Text>().text        = lv.ToString();
            string  heisyuName = "";
            Message msg        = new Message();
            if (heisyu == "YR")
            {
                heisyuName = msg.getMessage(56);
            }
            else if (heisyu == "KB")
            {
                heisyuName = msg.getMessage(55);
            }
            else if (heisyu == "YM")
            {
                heisyuName = msg.getMessage(58);
            }
            else if (heisyu == "TP")
            {
                heisyuName = msg.getMessage(57);
            }
            pop.transform.FindChild("childNameValue").GetComponent <Text>().text = heisyuName;
            pop.transform.FindChild("childNum").GetComponent <Text>().text       = chQty.ToString();
            pop.transform.FindChild("hpValue").GetComponent <Text>().text        = hp.ToString();
            pop.transform.FindChild("atkValue").GetComponent <Text>().text       = atk.ToString();
            pop.transform.FindChild("dfcValue").GetComponent <Text>().text       = dfc.ToString();
            pop.transform.FindChild("spdValue").GetComponent <Text>().text       = spd.ToString();

            //Senpou
            StatusGet sts          = new StatusGet();
            ArrayList senpouArray  = sts.getOriginalSenpou(busyoId, false);
            int       senpouId     = (int)senpouArray[0];
            string    senpouTyp    = senpouArray[1].ToString();
            string    senpouName   = senpouArray[2].ToString();
            string    senpouExp    = senpouArray[3].ToString();
            float     senpouEach   = (float)senpouArray[4];
            float     senpouRatio  = (float)senpouArray[5];
            float     senpouTerm   = (float)senpouArray[6];
            int       senpouStatus = (int)senpouArray[7];
            int       senpouLv     = (int)senpouArray[8];

            //Kahou Adjustment
            KahouStatusGet kahouSts         = new KahouStatusGet();
            string[]       KahouSenpouArray = kahouSts.getKahouForSenpou(busyoId.ToString(), senpouStatus);
            string         kahouTyp         = KahouSenpouArray[0];
            string         adjSenpouStatus  = senpouStatus.ToString();
            if (kahouTyp != null)
            {
                if (kahouTyp == "Attack")
                {
                    int kahouStatus = int.Parse(KahouSenpouArray[1]);
                    adjSenpouStatus = adjSenpouStatus + "<color=#35d74bFF>(+" + kahouStatus.ToString() + ")</color>";
                }
                else
                {
                    Debug.Log("Not Yet except for Attack");
                }
            }
            //Explanation Modification
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                senpouExp = senpouExp.Replace("ABC", adjSenpouStatus);
                senpouExp = senpouExp.Replace("DEF", senpouEach.ToString());
                senpouExp = senpouExp.Replace("GHI", senpouRatio.ToString());
                senpouExp = senpouExp.Replace("JKL", senpouTerm.ToString());
            }
            else
            {
                senpouExp = senpouExp.Replace("A", adjSenpouStatus);
                senpouExp = senpouExp.Replace("B", senpouEach.ToString());
                senpouExp = senpouExp.Replace("C", senpouRatio.ToString());
                senpouExp = senpouExp.Replace("D", senpouTerm.ToString());
            }

            //Fill fields by got Senpou Value
            pop.transform.FindChild("senpouNameValue").GetComponent <Text>().text = senpouName;
            pop.transform.FindChild("senpouExpValue").GetComponent <Text>().text  = senpouExp;
            pop.transform.FindChild("senpouLvValue").GetComponent <Text>().text   = senpouLv.ToString();


            //Saku
            Saku          saku     = new Saku();
            List <string> sakuList = new List <string>();
            sakuList = saku.getSakuInfo(busyoId);

            string     sakuPath = "Prefabs/Saku/saku" + sakuList[0];
            GameObject sakuIcon = Instantiate(Resources.Load(sakuPath)) as GameObject;
            foreach (Transform n in pop.transform)
            {
                if (n.tag == "Saku")
                {
                    GameObject.Destroy(n.gameObject);
                }
            }
            sakuIcon.transform.SetParent(pop.transform);
            sakuIcon.transform.localScale            = new Vector2(0.5f, 0.5f);
            sakuIcon.GetComponent <Button>().enabled = false;
            RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>();
            sakuIcon_transform.anchoredPosition = new Vector3(-220, -185, 0);
            sakuIcon_transform.transform.SetSiblingIndex(30);
            pop.transform.FindChild("sakuExpValue").GetComponent <Text>().text = sakuList[2];
            pop.transform.FindChild("sakuLvValue").GetComponent <Text>().text  = sakuList[3];

            //adjust
            if (Application.loadedLevelName == "preKaisen")
            {
                foreach (Transform chld in pop.transform)
                {
                    if (chld.GetComponent <ReplaceSpriteNameRank>())
                    {
                        string busyoImagePath = "Prefabs/Player/Sprite/unit" + busyoId;
                        chld.GetComponent <Image>().sprite =
                            Resources.Load(busyoImagePath, typeof(Sprite)) as Sprite;
                    }
                }
            }
        }
    }