コード例 #1
0
    void Awake()
    {
        initLife = life;

        if (name != "shiro")
        {
            BusyoInfoGet busyo = new BusyoInfoGet();
            belongDaimyoId = busyo.getDaimyoId(int.Parse(name));
            if (belongDaimyoId == 0)
            {
                belongDaimyoId = busyo.getDaimyoHst(int.Parse(name));
            }
        }
    }
コード例 #2
0
    // Use this for initialization
    public void PrepareBusyoScrollMenu(List <string> jinkeiBusyo_list)
    {
        //Clear Previous Unit
        foreach (Transform chd in GameObject.Find("Content").transform)
        {
            //Delete
            Destroy(chd.gameObject);
        }

        //Scroll View Change
        string myBusyoString = PlayerPrefs.GetString("myBusyo");

        char[] delimiterChars = { ',' };

        List <string> myBusyo_list = new List <string>();

        if (myBusyoString.Contains(","))
        {
            myBusyo_list = new List <string>(myBusyoString.Split(delimiterChars));
        }
        else
        {
            myBusyo_list.Add(myBusyoString);
        }

        for (int i = 0; i < jinkeiBusyo_list.Count; i++)
        {
            myBusyo_list.Remove(jinkeiBusyo_list[i]);
        }

        //Instantiate scroll view
        string       scrollPath  = "Prefabs/Jinkei/Slot";
        BusyoInfoGet busyoScript = new BusyoInfoGet();

        for (int j = 0; j < myBusyo_list.Count; j++)
        {
            //Slot
            GameObject prefab = Instantiate(Resources.Load(scrollPath)) as GameObject;
            prefab.transform.SetParent(GameObject.Find("Content").transform);
            prefab.transform.localScale    = new Vector3(1, 1, 1);
            prefab.transform.localPosition = new Vector3(0, 0, 0);
            prefab.name = "Slot";
            prefab.GetComponent <LayoutElement>().minHeight = 110;
            prefab.GetComponent <LayoutElement>().minWidth  = 110;

            //Busyo
            if (Application.loadedLevelName == "preKassen")
            {
                string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
                GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
                busyo.name = myBusyo_list[j];

                //Add Kamon
                string     KamonPath = "Prefabs/Jinkei/Kamon";
                GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                kamon.transform.SetParent(busyo.transform);
                kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                kamon.transform.localPosition = new Vector2(-15, -12);
                int daimyoId = busyoScript.getDaimyoId(int.Parse(busyo.name));
                if (daimyoId == 0)
                {
                    daimyoId = busyoScript.getDaimyoHst(int.Parse(busyo.name));
                }
                string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                kamon.GetComponent <Image>().sprite =
                    Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                //Add Heisyu
                string     heisyu     = busyoScript.getHeisyu(int.Parse(busyo.name));
                string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                heisyuObj.transform.SetParent(busyo.transform, false);
                heisyuObj.transform.localPosition = new Vector2(10, -10);
                heisyuObj.transform.SetAsFirstSibling();


                busyo.transform.SetParent(prefab.transform);
                busyo.transform.localScale = new Vector3(3, 3, 3);
                busyo.name = myBusyo_list[j].ToString();
                busyo.AddComponent <Senryoku>().GetPlayerSenryoku(busyo.name);

                busyo.transform.localPosition = new Vector3(0, 0, 0);
            }
            else if (Application.loadedLevelName == "preKaisen")
            {
                preKaisen  prekasienScript = new preKaisen();
                int        busyoId         = int.Parse(myBusyo_list[j]);
                string     path            = "Prefabs/Player/Unit/Ship";
                GameObject tsyBusyo        = Instantiate(Resources.Load(path)) as GameObject;
                tsyBusyo.name = busyoId.ToString();
                prekasienScript.getShipSprite(tsyBusyo, busyoId);

                //Add Kamon
                string     KamonPath = "Prefabs/Jinkei/Kamon";
                GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                kamon.transform.SetParent(tsyBusyo.transform);
                kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                kamon.transform.localPosition = new Vector2(-15, -12);
                int daimyoId = busyoScript.getDaimyoId(int.Parse(tsyBusyo.name));
                if (daimyoId == 0)
                {
                    daimyoId = busyoScript.getDaimyoHst(int.Parse(tsyBusyo.name));
                }
                string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                kamon.GetComponent <Image>().sprite =
                    Resources.Load(imagePath, typeof(Sprite)) as Sprite;


                tsyBusyo.transform.SetParent(prefab.transform);
                tsyBusyo.transform.localScale = new Vector3(3, 3, 3);
                tsyBusyo.name = myBusyo_list[j].ToString();
                tsyBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(tsyBusyo.name);

                tsyBusyo.transform.localPosition = new Vector3(0, 0, 0);
            }
        }
    }
コード例 #3
0
    public void GetPlayerSenryoku(string busyoId)
    {
        int  i      = 0;
        bool result = int.TryParse(busyoId, out i);

        if (result)
        {
            //Parent
            int myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo");
            if (int.Parse(busyoId) == myDaimyoBusyo)
            {
                myDaimyoBusyoFlg = true;
            }

            BusyoInfoGet busyo = new BusyoInfoGet();
            belongDaimyoId = busyo.getDaimyoId(int.Parse(busyoId));
            if (belongDaimyoId == 0)
            {
                belongDaimyoId = busyo.getDaimyoHst(int.Parse(busyoId));
            }
            shipId = busyo.getShipId(int.Parse(busyoId));

            lv = PlayerPrefs.GetInt(busyoId, 1);
            StatusGet sts = new StatusGet();
            int       hp  = sts.getHp(int.Parse(busyoId), lv);
            int       atk = sts.getAtk(int.Parse(busyoId), lv);
            int       dfc = sts.getDfc(int.Parse(busyoId), lv);
            int       spd = sts.getSpd(int.Parse(busyoId), lv);

            int adjHp  = hp * 100;
            int adjAtk = atk * 10;
            int adjDfc = dfc * 10;

            JyosyuHeiryoku jyosyuHei    = new JyosyuHeiryoku();
            int            addJyosyuHei = jyosyuHei.GetJyosyuHeiryoku(busyoId.ToString());

            KahouStatusGet kahouSts         = new KahouStatusGet();
            string[]       KahouStatusArray = kahouSts.getKahouForStatus(busyoId, adjHp, adjAtk, adjDfc, spd);
            int            totalBusyoHp     = 0;
            int            totalBusyoAtk    = 0;
            int            totalBusyoDfc    = 0;

            string kanniTmp      = "kanni" + busyoId;
            float  addAtkByKanni = 0;
            float  addHpByKanni  = 0;
            float  addDfcByKanni = 0;

            if (PlayerPrefs.HasKey(kanniTmp))
            {
                int kanniId = PlayerPrefs.GetInt(kanniTmp);
                if (kanniId != 0)
                {
                    Kanni kanni = new Kanni();

                    //Status
                    string kanniTarget = kanni.getEffectTarget(kanniId);
                    int    effect      = kanni.getEffect(kanniId);
                    if (kanniTarget == "atk")
                    {
                        addAtkByKanni = ((float)adjAtk * (float)effect) / 100;
                    }
                    else if (kanniTarget == "hp")
                    {
                        addHpByKanni = ((float)adjHp * (float)effect) / 100;
                    }
                    else if (kanniTarget == "dfc")
                    {
                        addDfcByKanni = ((float)adjDfc * (float)effect) / 100;
                    }
                }
            }

            totalBusyoAtk = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni);
            totalBusyoHp  = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni) + addJyosyuHei;
            totalBusyoDfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni);
            totalSpd      = spd + int.Parse(KahouStatusArray[3]);
            if (Application.loadedLevelName == "preKaisen")
            {
                if (shipId == 1)
                {
                    totalBusyoHp = totalBusyoHp * 2;
                }
                else if (shipId == 2)
                {
                    totalBusyoHp = Mathf.FloorToInt((float)totalBusyoHp * 1.5f);
                }
            }

            //Child
            string heiId   = "hei" + busyoId.ToString();
            string chParam = PlayerPrefs.GetString(heiId, "0");
            if (chParam == "0" || chParam == "")
            {
                StatusGet statusScript = new StatusGet();
                string    heisyu       = statusScript.getHeisyu(int.Parse(busyoId));
                chParam = heisyu + ":1:1:1";
                PlayerPrefs.SetString(heiId, chParam);
                PlayerPrefs.Flush();
            }

            char[] delimiterChars = { ':' };
            if (chParam.Contains(":"))
            {
                string[] ch_list = chParam.Split(delimiterChars);

                chQty = int.Parse(ch_list [1]);
                chlv  = int.Parse(ch_list [2]);
                int ch_status    = int.Parse(ch_list [3]);
                int totalChldHp  = 0;
                int totalChldAtk = 0;
                int totalChldDfc = 0;

                ch_status = ch_status * 10;
                int atkDfc = (int)sts.getChAtkDfc(ch_status, totalBusyoHp);

                totalChldHp  = ch_status * chQty;
                totalChldAtk = atkDfc * chQty;
                totalChldDfc = atkDfc * chQty;

                //Set value
                totalHp  = totalBusyoHp + totalChldHp;
                totalAtk = totalBusyoAtk + totalChldAtk;
                totalDfc = totalBusyoDfc + totalChldDfc;
            }
        }
    }
コード例 #4
0
ファイル: TouyouView.cs プロジェクト: pratikxman/Sengoku2d
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [0].Play();

        //Panel
        GameObject.Find("Touyou").GetComponent <Canvas>().sortingLayerName = "unit";

        //Pop View
        BusyoStatusButton pop   = new BusyoStatusButton();
        GameObject        board = pop.commonPopup(27);

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            GameObject.Find("popText").GetComponent <Text> ().text = "Samurai Recruitment";
        }
        else
        {
            GameObject.Find("popText").GetComponent <Text>().text = "武将登用";
        }
        //Kamon
        string     kamonPath = "Prefabs/Touyou/kamon";
        GameObject kamon     = Instantiate(Resources.Load(kamonPath)) as GameObject;

        kamon.transform.SetParent(board.transform);
        kamon.transform.localScale    = new Vector2(1, 1);
        kamon.transform.localPosition = new Vector2(-310, 0);
        BusyoInfoGet busyoScript = new BusyoInfoGet();
        int          daimyoId    = busyoScript.getDaimyoId(busyoId);

        if (daimyoId == 0)
        {
            daimyoId = busyoScript.getDaimyoHst(busyoId);
        }
        string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();

        kamon.GetComponent <Image> ().sprite =
            Resources.Load(imagePath, typeof(Sprite)) as Sprite;

        //Busyo View
        string     path  = "Prefabs/Player/Unit/BusyoUnit";
        GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject;

        Busyo.name = busyoId.ToString();
        Busyo.transform.SetParent(board.transform);
        Busyo.transform.localScale = new Vector2(3.5f, 3.5f);
        Busyo.GetComponent <DragHandler>().enabled = false;
        RectTransform busyo_transform = Busyo.GetComponent <RectTransform>();

        busyo_transform.anchoredPosition = new Vector3(350, 300, 0);
        busyo_transform.sizeDelta        = new Vector2(100, 100);

        //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(-40, -40, 0);
        ShipObj.transform.localScale    = new Vector2(0.5f, 0.5f);
        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 = "下";
            }
        }


        //Text Modification
        Busyo.transform.FindChild("Text").gameObject.GetComponent <Text>().enabled = false;

        //Rank Text Modification
        GameObject    rank           = Busyo.transform.FindChild("Rank").gameObject;
        RectTransform rank_transform = rank.GetComponent <RectTransform>();

        rank_transform.anchoredPosition     = new Vector3(0, -50, 0);
        rank_transform.sizeDelta            = new Vector2(200, 200);
        rank.GetComponent <Text>().fontSize = 200;

        /*Status*/
        string     statusPath = "Prefabs/Touyou/busyoStatus";
        GameObject status     = Instantiate(Resources.Load(statusPath)) as GameObject;

        status.transform.SetParent(board.transform);
        status.transform.localScale = new Vector2(1, 1);
        RectTransform status_transform = status.GetComponent <RectTransform>();

        status_transform.anchoredPosition = new Vector3(245, -40, 0);


        Entity_busyo_mst  busyoMst  = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        Entity_senpou_mst senpouMst = Resources.Load("Data/senpou_mst") as Entity_senpou_mst;
        string            busyoName = busyoScript.getName(busyoId);

        GameObject.Find("busyoNameValue").GetComponent <Text>().text = busyoName;
        GameObject.Find("TosotsuValue").GetComponent <Text>().text   = busyoMst.param [busyoId - 1].minHp.ToString() + "00";
        GameObject.Find("BuyuuValue").GetComponent <Text> ().text    = busyoMst.param [busyoId - 1].minAtk.ToString() + "0";
        GameObject.Find("ChiryakuValue").GetComponent <Text>().text  = busyoMst.param [busyoId - 1].minDfc.ToString() + "0";
        GameObject.Find("SpeedValue").GetComponent <Text>().text     = busyoMst.param [busyoId - 1].minSpd.ToString();

        string  heisyuType = busyoMst.param [busyoId - 1].heisyu;
        string  heisyu     = "";
        Message msg        = new Message();

        if (heisyuType == "KB")
        {
            heisyu = msg.getMessage(55);
        }
        else if (heisyuType == "YR")
        {
            heisyu = msg.getMessage(56);
        }
        else if (heisyuType == "TP")
        {
            heisyu = msg.getMessage(57);
        }
        else if (heisyuType == "YM")
        {
            heisyu = msg.getMessage(58);
        }

        GameObject.Find("ChildNameValue").GetComponent <Text>().text = heisyu;

        int senpouId = busyoMst.param [busyoId - 1].senpou_id;

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].nameEng;
        }
        else
        {
            GameObject.Find("SenpouValue").GetComponent <Text>().text = senpouMst.param[senpouId - 1].name;
        }
        int    senpouStatus = senpouMst.param [senpouId - 1].lv1;
        int    each         = (int)senpouMst.param [senpouId - 1].each;
        int    ratio        = (int)senpouMst.param [senpouId - 1].ratio;
        int    term         = (int)senpouMst.param [senpouId - 1].term;
        string senpouExp    = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouMst.param [senpouId - 1].effectionEng;
        }
        else
        {
            senpouExp = senpouMst.param[senpouId - 1].effection;
        }
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouExp = senpouExp.Replace("ABC", senpouStatus.ToString());
            senpouExp = senpouExp.Replace("DEF", each.ToString());
            senpouExp = senpouExp.Replace("GHI", ratio.ToString());
            senpouExp = senpouExp.Replace("JKL", term.ToString());
        }
        else
        {
            senpouExp = senpouExp.Replace("A", senpouStatus.ToString());
            senpouExp = senpouExp.Replace("B", each.ToString());
            senpouExp = senpouExp.Replace("C", ratio.ToString());
            senpouExp = senpouExp.Replace("D", term.ToString());
        }
        GameObject.Find("SenpouExpValue").GetComponent <Text>().text = senpouExp;


        /*Saku*/
        Saku          saku     = new Saku();
        List <string> sakuList = new List <string>();

        sakuList = saku.getSakuInfo(busyoId);

        //Icon
        string     sakuPath   = "Prefabs/Saku/saku" + sakuList[0];
        GameObject sakuIcon   = Instantiate(Resources.Load(sakuPath)) as GameObject;
        GameObject StatusSaku = status.transform.FindChild("StatusSaku").gameObject;

        foreach (Transform n in StatusSaku.transform)
        {
            if (n.tag == "Saku")
            {
                GameObject.Destroy(n.gameObject);
            }
        }
        sakuIcon.transform.SetParent(StatusSaku.transform);
        sakuIcon.transform.localScale            = new Vector2(0.7f, 0.7f);
        sakuIcon.GetComponent <Button>().enabled = false;
        RectTransform sakuIcon_transform = sakuIcon.GetComponent <RectTransform>();

        sakuIcon_transform.anchoredPosition = new Vector3(-235, 0, 0);

        StatusSaku.transform.FindChild("SakuExp").transform.FindChild("SakuExpValue").GetComponent <Text>().text = sakuList[2];

        /*daimyo busyo check*/
        Daimyo daimyo = new Daimyo();

        daimyoFlg = daimyo.daimyoBusyoCheck(busyoId);

        //pass data to button
        GameObject touyouBtn = GameObject.Find("TouyouButton").gameObject;

        touyouBtn.GetComponent <DoTouyou> ().busyoId   = busyoId;
        touyouBtn.GetComponent <DoTouyou> ().busyoName = busyoName;
        touyouBtn.GetComponent <DoTouyou> ().heisyu    = heisyuType;
        touyouBtn.GetComponent <DoTouyou> ().sequence  = int.Parse(name);
        touyouBtn.GetComponent <DoTouyou> ().rank      = busyoRank;
        touyouBtn.GetComponent <DoTouyou> ().daimyoFlg = daimyoFlg;


        //Tutorial
        if (Application.loadedLevelName == "tutorialTouyou")
        {
            TutorialController tutorialScript = new TutorialController();
            Vector2            vect           = new Vector2(0, 50);
            GameObject         btn            = tutorialScript.SetPointer(touyouBtn, vect);
            btn.transform.localScale = new Vector2(150, 150);
        }

        //Hired Check
        if (Application.loadedLevelName != "tutorialTouyou")
        {
            string myBusyo        = PlayerPrefs.GetString("myBusyo");
            char[] delimiterChars = { ',' };

            if (myBusyo != null && myBusyo != "")
            {
                List <string> myBusyoList = new List <string>();
                if (myBusyo.Contains(","))
                {
                    myBusyoList = new List <string>(myBusyo.Split(delimiterChars));
                }
                else
                {
                    myBusyoList.Add(myBusyo);
                }

                if (myBusyoList.Contains(busyoId.ToString()))
                {
                    msg.makeMessage(msg.getMessage(137));
                }
            }
            //Zukan Check
            string zukanBusyoHst = PlayerPrefs.GetString("zukanBusyoHst");
            if (zukanBusyoHst != null && zukanBusyoHst != "")
            {
                List <string> myZukanList = new List <string>();
                if (zukanBusyoHst.Contains(","))
                {
                    myZukanList = new List <string>(zukanBusyoHst.Split(delimiterChars));
                }
                else
                {
                    myZukanList.Add(zukanBusyoHst);
                }

                if (myZukanList.Contains(busyoId.ToString()))
                {
                    string     zukanPath = "Prefabs/Touyou/Zukan";
                    GameObject zukan     = Instantiate(Resources.Load(zukanPath)) as GameObject;
                    zukan.transform.SetParent(board.transform);
                    zukan.transform.localScale    = new Vector2(1, 1);
                    zukan.transform.localPosition = new Vector2(-41, 167);
                }
            }
        }
    }
コード例 #5
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [0].Play();

        Resources.UnloadUnusedAssets();
        ButtonColorChanger(name);

        if (Application.loadedLevelName == "preKassen")
        {
            preKassen preKassenScript = GameObject.Find("GameScene").GetComponent <preKassen>();
            int       jinkei          = 0;
            if (name == "Gyorin")
            {
                jinkei = 1;
            }
            else if (name == "Kakuyoku")
            {
                jinkei = 2;
            }
            else if (name == "Engetsu")
            {
                jinkei = 3;
            }
            else if (name == "Gankou")
            {
                jinkei = 4;
            }
            int  weatherId     = preKassenScript.weatherId;
            bool isAttackedFlg = preKassenScript.isAttackedFlg;

            preKassenScript.prekassenPlayerJinkei(jinkei, weatherId, isAttackedFlg, true);
        }
        else if (Application.loadedLevelName == "preKaisen")
        {
            preKaisen preKassenScript = GameObject.Find("GameScene").GetComponent <preKaisen>();
            int       jinkei          = 0;
            if (name == "Gyorin")
            {
                jinkei = 1;
            }
            else if (name == "Kakuyoku")
            {
                jinkei = 2;
            }
            else if (name == "Engetsu")
            {
                jinkei = 3;
            }
            else if (name == "Gankou")
            {
                jinkei = 4;
            }
            int  weatherId     = preKassenScript.weatherId;
            bool isAttackedFlg = preKassenScript.isAttackedFlg;

            preKassenScript.prekassenPlayerJinkei(jinkei, weatherId, isAttackedFlg, true);
        }
        else
        {
            GameObject kakuteiButton = GameObject.Find("KakuteiButton");
            GameObject gameScene     = GameObject.Find("GameScene") as GameObject;
            int        busyoQty      = 0;

            //Clear Previous Unit
            foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
            {
                if (obs.transform.childCount > 0)
                {
                    //Delete
                    DestroyImmediate(obs.transform.GetChild(0).gameObject);
                }
            }

            //魚鱗
            BusyoInfoGet busyoScript = new BusyoInfoGet();
            if (name == "Gyorin")
            {
                int soudaisyo = PlayerPrefs.GetInt("soudaisyo1");

                List <string> jinkeiBusyo_list = new List <string>();
                kakuteiButton.GetComponent <Jinkei>().selectedJinkei = 1;

                foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
                {
                    //Enable 1,2,7,8,11,12,13,14,17,18,21,22
                    if (obs.name == "Slot1" || obs.name == "Slot2" || obs.name == "Slot7" || obs.name == "Slot8" ||
                        obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot13" || obs.name == "Slot14" ||
                        obs.name == "Slot17" || obs.name == "Slot18" || obs.name == "Slot21" || obs.name == "Slot22")
                    {
                        obs.GetComponent <Image>().enabled = true;
                        string mapId = "1map" + obs.name.Substring(4);
                        if (PlayerPrefs.HasKey(mapId))
                        {
                            busyoQty = busyoQty + 1;
                            int busyoId = PlayerPrefs.GetInt(mapId);

                            //Instantiate
                            string     path      = "Prefabs/Player/Unit/BusyoUnit";
                            GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.parent     = obs.transform;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.localScale = new Vector2(4, 4);
                            chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);
                            jinkeiBusyo_list.Add(busyoId.ToString());

                            chldBusyo.transform.localPosition = new Vector3(0, 0, 0);
                            //Button
                            chldBusyo.AddComponent <Button>();
                            chldBusyo.AddComponent <Soudaisyo>();
                            chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                            //soudaisyo
                            if (soudaisyo == int.Parse(chldBusyo.name))
                            {
                                chldBusyo.GetComponent <Soudaisyo>().OnClick();
                            }

                            //Add Kamon
                            string     KamonPath = "Prefabs/Jinkei/Kamon";
                            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                            kamon.transform.SetParent(chldBusyo.transform);
                            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                            kamon.transform.localPosition = new Vector2(-15, -12);
                            int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                            if (daimyoId == 0)
                            {
                                daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                            }
                            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                            kamon.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            //Add Heisyu
                            string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                            heisyuObj.transform.SetParent(chldBusyo.transform, false);
                            heisyuObj.transform.localPosition = new Vector2(10, -10);
                            heisyuObj.transform.SetAsFirstSibling();
                        }

                        //Disable 3,4,5,6,9,15,16,19,20,23,24,25
                    }
                    else
                    {
                        obs.GetComponent <Image>().enabled = false;

                        if (obs.transform.IsChildOf(obs.transform))
                        {
                            foreach (Transform n in obs.transform)
                            {
                                GameObject.Destroy(n.gameObject);
                            }
                        }
                    }
                }
                gameScene.GetComponent <JinkeiScene>().UnitOnScrollView(jinkeiBusyo_list);

                //鶴翼
            }
            else if (name == "Kakuyoku")
            {
                int soudaisyo = PlayerPrefs.GetInt("soudaisyo2");

                List <string> jinkeiBusyo_list = new List <string>();
                kakuteiButton.GetComponent <Jinkei>().selectedJinkei = 2;

                foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
                {
                    //Enable 3,4,5,7,8,11,12,17,18,23,24,25
                    if (obs.name == "Slot3" || obs.name == "Slot4" || obs.name == "Slot5" || obs.name == "Slot7" ||
                        obs.name == "Slot8" || obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot17" ||
                        obs.name == "Slot18" || obs.name == "Slot23" || obs.name == "Slot24" || obs.name == "Slot25")
                    {
                        obs.GetComponent <Image>().enabled = true;
                        string mapId = "2map" + obs.name.Substring(4);
                        if (PlayerPrefs.HasKey(mapId))
                        {
                            busyoQty = busyoQty + 1;
                            int busyoId = PlayerPrefs.GetInt(mapId);

                            //Instantiate
                            string     path      = "Prefabs/Player/Unit/BusyoUnit";
                            GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.parent     = obs.transform;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.localScale = new Vector2(4, 4);
                            chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);
                            jinkeiBusyo_list.Add(busyoId.ToString());

                            chldBusyo.transform.localPosition = new Vector3(0, 0, 0);
                            //Button
                            chldBusyo.AddComponent <Button>();
                            chldBusyo.AddComponent <Soudaisyo>();
                            chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                            //soudaisyo
                            if (soudaisyo == int.Parse(chldBusyo.name))
                            {
                                chldBusyo.GetComponent <Soudaisyo>().OnClick();
                            }

                            //Add Kamon
                            string     KamonPath = "Prefabs/Jinkei/Kamon";
                            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                            kamon.transform.SetParent(chldBusyo.transform);
                            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                            kamon.transform.localPosition = new Vector2(-15, -12);
                            int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                            if (daimyoId == 0)
                            {
                                daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                            }
                            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                            kamon.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            //Add Heisyu
                            string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                            heisyuObj.transform.SetParent(chldBusyo.transform, false);
                            heisyuObj.transform.localPosition = new Vector2(10, -10);
                            heisyuObj.transform.SetAsFirstSibling();
                        }

                        //Disable 1,2,6,9,10,13,14,15,16,19,20,21
                    }
                    else
                    {
                        obs.GetComponent <Image>().enabled = false;

                        if (obs.transform.IsChildOf(obs.transform))
                        {
                            foreach (Transform n in obs.transform)
                            {
                                GameObject.Destroy(n.gameObject);
                            }
                        }
                    }
                }
                gameScene.GetComponent <JinkeiScene>().UnitOnScrollView(jinkeiBusyo_list);

                //偃月
            }
            else if (name == "Engetsu")
            {
                int soudaisyo = PlayerPrefs.GetInt("soudaisyo3");

                List <string> jinkeiBusyo_list = new List <string>();
                kakuteiButton.GetComponent <Jinkei>().selectedJinkei = 3;

                foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
                {
                    //Enable 3,7,8,9,11,12,14,15,16,20,21,25
                    if (obs.name == "Slot3" || obs.name == "Slot7" || obs.name == "Slot8" || obs.name == "Slot9" ||
                        obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot14" || obs.name == "Slot15" ||
                        obs.name == "Slot16" || obs.name == "Slot20" || obs.name == "Slot21" || obs.name == "Slot25")
                    {
                        obs.GetComponent <Image>().enabled = true;
                        string mapId = "3map" + obs.name.Substring(4);
                        if (PlayerPrefs.HasKey(mapId))
                        {
                            busyoQty = busyoQty + 1;
                            int busyoId = PlayerPrefs.GetInt(mapId);

                            //Instantiate
                            string     path      = "Prefabs/Player/Unit/BusyoUnit";
                            GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.parent     = obs.transform;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.localScale = new Vector2(4, 4);
                            chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);
                            jinkeiBusyo_list.Add(busyoId.ToString());

                            chldBusyo.transform.localPosition = new Vector3(0, 0, 0);
                            //Button
                            chldBusyo.AddComponent <Button>();
                            chldBusyo.AddComponent <Soudaisyo>();
                            chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                            //soudaisyo
                            if (soudaisyo == int.Parse(chldBusyo.name))
                            {
                                chldBusyo.GetComponent <Soudaisyo>().OnClick();
                            }

                            //Add Kamon
                            string     KamonPath = "Prefabs/Jinkei/Kamon";
                            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                            kamon.transform.SetParent(chldBusyo.transform);
                            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                            kamon.transform.localPosition = new Vector2(-15, -12);
                            int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                            if (daimyoId == 0)
                            {
                                daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                            }
                            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                            kamon.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            //Add Heisyu
                            string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                            heisyuObj.transform.SetParent(chldBusyo.transform, false);
                            heisyuObj.transform.localPosition = new Vector2(10, -10);
                            heisyuObj.transform.SetAsFirstSibling();
                        }

                        //Disable 1,2,4,5,6,10,13,17,18,19,22,23,24
                    }
                    else
                    {
                        obs.GetComponent <Image>().enabled = false;
                        if (obs.transform.IsChildOf(obs.transform))
                        {
                            foreach (Transform n in obs.transform)
                            {
                                GameObject.Destroy(n.gameObject);
                            }
                        }
                    }
                }
                gameScene.GetComponent <JinkeiScene>().UnitOnScrollView(jinkeiBusyo_list);

                //雁行
            }
            else if (name == "Gankou")
            {
                int soudaisyo = PlayerPrefs.GetInt("soudaisyo4");

                List <string> jinkeiBusyo_list = new List <string>();
                kakuteiButton.GetComponent <Jinkei>().selectedJinkei = 4;

                foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
                {
                    //Enable 1,2,7,8,12,13,14,18,19,20,24,25
                    if (obs.name == "Slot1" || obs.name == "Slot2" || obs.name == "Slot7" || obs.name == "Slot8" ||
                        obs.name == "Slot12" || obs.name == "Slot13" || obs.name == "Slot14" || obs.name == "Slot18" ||
                        obs.name == "Slot19" || obs.name == "Slot20" || obs.name == "Slot24" || obs.name == "Slot25")
                    {
                        obs.GetComponent <Image>().enabled = true;
                        string mapId = "4map" + obs.name.Substring(4);
                        if (PlayerPrefs.HasKey(mapId))
                        {
                            busyoQty = busyoQty + 1;
                            int busyoId = PlayerPrefs.GetInt(mapId);

                            //Instantiate
                            string     path      = "Prefabs/Player/Unit/BusyoUnit";
                            GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.parent     = obs.transform;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.localScale = new Vector2(4, 4);
                            chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);
                            jinkeiBusyo_list.Add(busyoId.ToString());

                            chldBusyo.transform.localPosition = new Vector3(0, 0, 0);
                            //Button
                            chldBusyo.AddComponent <Button>();
                            chldBusyo.AddComponent <Soudaisyo>();
                            chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                            //soudaisyo
                            if (soudaisyo == int.Parse(chldBusyo.name))
                            {
                                chldBusyo.GetComponent <Soudaisyo>().OnClick();
                            }

                            //Add Kamon
                            string     KamonPath = "Prefabs/Jinkei/Kamon";
                            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                            kamon.transform.SetParent(chldBusyo.transform);
                            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                            kamon.transform.localPosition = new Vector2(-15, -12);
                            int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                            if (daimyoId == 0)
                            {
                                daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                            }
                            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                            kamon.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            //Add Heisyu
                            string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                            heisyuObj.transform.SetParent(chldBusyo.transform, false);
                            heisyuObj.transform.localPosition = new Vector2(10, -10);
                            heisyuObj.transform.SetAsFirstSibling();
                        }

                        //Disable 3,4,5,6,9,10,11,15,16,17,21,22,23
                    }
                    else
                    {
                        obs.GetComponent <Image>().enabled = false;
                        if (obs.transform.IsChildOf(obs.transform))
                        {
                            foreach (Transform n in obs.transform)
                            {
                                GameObject.Destroy(n.gameObject);
                            }
                        }
                    }
                }
                gameScene.GetComponent <JinkeiScene>().UnitOnScrollView(jinkeiBusyo_list);
            }

            //Qty of Busyo on Status
            GameObject.Find("jinkeiQtyValue").GetComponent <Text> ().text = busyoQty.ToString();

            JinkeiPowerEffection powerEffection = new JinkeiPowerEffection();
            powerEffection.UpdateSenryoku();
        }
    }
コード例 #6
0
ファイル: RonkouScene.cs プロジェクト: pratikxman/Sengoku2d
    public string createScrollView(List <string> myBusyo_list, string minBusyoId, GameObject mainController, bool initflg)
    {
        //Scroll View
        string myBusyoString   = "";
        bool   tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialBusyo")
        {
            myBusyoString = PlayerPrefs.GetString("myBusyo");
        }
        else
        {
            //retry tutorial
            myBusyoString = "19," + PlayerPrefs.GetInt("tutorialBusyo").ToString();;
        }
        char[] delimiterChars = { ',' };
        myBusyo_list.AddRange(myBusyoString.Split(delimiterChars));

        //Sort by Jinkei
        List <string> myBusyoList         = new List <string>();
        List <string> jinkeiTrueBusyoList = new List <string>();

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialBusyo")
        {
            List <string> jinkeiFalseBusyoList = new List <string>();
            for (int i = 0; i < myBusyo_list.Count; i++)
            {
                int  busyoId   = int.Parse(myBusyo_list[i]);
                bool jinkeiFlg = jinkeiBusyoCheck(busyoId);
                if (jinkeiFlg)
                {
                    jinkeiTrueBusyoList.Add(busyoId.ToString());
                }
                else
                {
                    jinkeiFalseBusyoList.Add(busyoId.ToString());
                }
            }

            myBusyoList.AddRange(jinkeiTrueBusyoList);
            myBusyoList.AddRange(jinkeiFalseBusyoList);
        }
        else
        {
            //retry tutorial
            myBusyoList.AddRange(myBusyo_list);
        }

        //Instantiate scroll view
        string       scrollPath  = "Prefabs/Busyo/Slot";
        BusyoInfoGet busyoScript = new BusyoInfoGet();
        GameObject   content     = GameObject.Find("Content");

        for (int j = 0; j < myBusyoList.Count; j++)
        {
            //Slot
            GameObject prefab = Instantiate(Resources.Load(scrollPath)) as GameObject;
            prefab.transform.SetParent(content.transform);
            prefab.transform.localScale    = new Vector3(1, 1, 1);
            prefab.transform.localPosition = new Vector3(330, -75, 0);

            //Busyo
            string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
            GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
            busyo.name = myBusyoList[j].ToString();
            busyo.transform.SetParent(prefab.transform);
            busyo.transform.localScale    = new Vector3(4, 4, 4);
            busyo.transform.localPosition = new Vector3(100, -75, 0);
            prefab.name = "Slot" + busyo.name;

            busyo.GetComponent <DragHandler> ().enabled = false;

            //Default
            if (initflg)
            {
                if (j == 0)
                {
                    firstSlot = prefab.gameObject;
                }
            }

            //kamon
            string     KamonPath = "Prefabs/Jinkei/Kamon";
            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
            kamon.transform.SetParent(busyo.transform);
            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
            kamon.transform.localPosition = new Vector2(-15, -12);
            int daimyoId = busyoScript.getDaimyoId(int.Parse(busyo.name));
            if (daimyoId == 0)
            {
                daimyoId = busyoScript.getDaimyoHst(int.Parse(busyo.name));
            }
            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
            kamon.GetComponent <Image>().sprite =
                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

            //Heisyu
            string     heisyu     = busyoScript.getHeisyu(int.Parse(busyo.name));
            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
            heisyuObj.transform.SetParent(busyo.transform, false);
            heisyuObj.transform.localPosition = new Vector2(10, -10);
            heisyuObj.transform.SetAsFirstSibling();

            //Jinkei Exist
            if (jinkeiTrueBusyoList.Contains(busyo.name))
            {
                prefab.GetComponent <BusyoView>().jinkeiFlg = true;
            }
        }

        minBusyoId = myBusyoList[0].ToString();
        mainController.GetComponent <NowOnBusyo>().OnBusyo = myBusyoList[0].ToString();
        string busyoName = busyoScript.getName(int.Parse(minBusyoId));

        mainController.GetComponent <NowOnBusyo>().OnBusyoName = busyoName;

        //Busyo Qty Limit
        int stockLimit = PlayerPrefs.GetInt("stockLimit");

        GameObject.Find("LimitBusyoQtyValue").GetComponent <Text>().text = stockLimit.ToString();
        GameObject.Find("NowBusyoQtyValue").GetComponent <Text>().text   = myBusyoList.Count.ToString();

        return(minBusyoId);
    }
コード例 #7
0
ファイル: JinkeiScene.cs プロジェクト: pratikxman/Sengoku2d
    public void UnitOnScrollViewTutorial()
    {
        //Clear Previous Unit
        foreach (Transform chd in GameObject.Find("Content").transform)
        {
            //Delete
            Destroy(chd.gameObject);
        }

        //Scroll View Change
        string myBusyoTutorial = PlayerPrefs.GetInt("tutorialBusyo").ToString();

        //Instantiate scroll view
        string       scrollPath  = "Prefabs/Jinkei/Slot";
        BusyoInfoGet busyoScript = new BusyoInfoGet();

        if (myBusyoTutorial != "0")
        {
            //Slot
            GameObject prefab = Instantiate(Resources.Load(scrollPath)) as GameObject;
            prefab.transform.SetParent(GameObject.Find("Content").transform);
            prefab.transform.localScale    = new Vector3(1, 1, 1);
            prefab.transform.localPosition = new Vector3(0, 0, 0);
            prefab.name = "Slot";

            //Busyo
            string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
            GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
            busyo.name = myBusyoTutorial;

            //Add Kamon
            string     KamonPath = "Prefabs/Jinkei/Kamon";
            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
            kamon.transform.SetParent(busyo.transform);
            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
            kamon.transform.localPosition = new Vector2(-15, -12);
            int daimyoId = busyoScript.getDaimyoId(int.Parse(busyo.name));
            if (daimyoId == 0)
            {
                daimyoId = busyoScript.getDaimyoHst(int.Parse(busyo.name));
            }
            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
            kamon.GetComponent <Image>().sprite =
                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

            //Add Heisyu
            string     heisyu     = busyoScript.getHeisyu(int.Parse(busyo.name));
            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
            heisyuObj.transform.SetParent(busyo.transform, false);
            heisyuObj.transform.localPosition = new Vector2(10, -10);
            heisyuObj.transform.SetAsFirstSibling();


            busyo.transform.SetParent(prefab.transform);
            busyo.transform.localScale = new Vector3(4, 4, 4);
            busyo.name = myBusyoTutorial.ToString();
            busyo.AddComponent <Senryoku>().GetPlayerSenryoku(busyo.name);

            busyo.transform.localPosition = new Vector3(0, 0, 0);
        }
    }
コード例 #8
0
ファイル: JinkeiScene.cs プロジェクト: pratikxman/Sengoku2d
    void Start()
    {
        bool tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialHyojyo")
        {
            //Kamon
            int    myDaimyo           = PlayerPrefs.GetInt("myDaimyo");
            string myDaimyoStatusPath = "Prefabs/Kamon/" + myDaimyo.ToString();
            GameObject.Find("KamonView").GetComponent <Image>().sprite =
                Resources.Load(myDaimyoStatusPath, typeof(Sprite)) as Sprite;

            //jinkei limit update
            Exp kuniExp     = new Exp();
            int kuniLv      = PlayerPrefs.GetInt("kuniLv");
            int jinkeiLimit = kuniExp.getJinkeiLimit(kuniLv);
            PlayerPrefs.SetInt("jinkeiLimit", jinkeiLimit);
            PlayerPrefs.Flush();

            /*Status Initial View*/
            int addLimit = 0;
            if (PlayerPrefs.GetBool("addJinkei1"))
            {
                addLimit = 1;
            }
            if (PlayerPrefs.GetBool("addJinkei2"))
            {
                addLimit = addLimit + 1;
            }
            if (PlayerPrefs.GetBool("addJinkei3"))
            {
                addLimit = addLimit + 1;
            }
            if (PlayerPrefs.GetBool("addJinkei4"))
            {
                addLimit = addLimit + 1;
            }
            int totalLimit = jinkeiLimit + addLimit;
            GameObject.Find("jinkeiLimitValue").GetComponent <Text>().text = totalLimit.ToString();


            totalHpValue  = GameObject.Find("totalHpValue").gameObject;
            totalAtkValue = GameObject.Find("totalAtkValue").gameObject;
            totalDfcValue = GameObject.Find("totalDfcValue").gameObject;
            KakuteiButton = GameObject.Find("KakuteiButton").gameObject;

            JinkeiFormButton jinkeiForm       = new JinkeiFormButton();
            List <string>    jinkeiBusyo_list = new List <string>();

            //Jinkei View Change
            int jinkei = PlayerPrefs.GetInt("jinkei");
            KakuteiButton.GetComponent <Jinkei> ().selectedJinkei = jinkei;

            BusyoInfoGet busyoScript = new BusyoInfoGet();
            if (jinkei == 1)
            {
                int soudaisyo = PlayerPrefs.GetInt("soudaisyo1");
                //Clear Previous Unit
                foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
                {
                    //Enable 1,2,7,8,11,12,13,14,17,18,21,22
                    if (obs.name == "Slot1" || obs.name == "Slot2" || obs.name == "Slot7" || obs.name == "Slot8" ||
                        obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot13" || obs.name == "Slot14" ||
                        obs.name == "Slot17" || obs.name == "Slot18" || obs.name == "Slot21" || obs.name == "Slot22")
                    {
                        obs.GetComponent <Image> ().enabled = true;
                        string mapId = "1map" + obs.name.Substring(4);
                        if (PlayerPrefs.HasKey(mapId))
                        {
                            int busyoId = PlayerPrefs.GetInt(mapId);
                            jinkeiBusyo_list.Add(busyoId.ToString());

                            //Instantiate
                            string     path      = "Prefabs/Player/Unit/BusyoUnit";
                            GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.parent     = obs.transform;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.localScale = new Vector2(4, 4);
                            chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);

                            chldBusyo.transform.localPosition = new Vector3(0, 0, 0);

                            //Button
                            chldBusyo.AddComponent <Button>();
                            chldBusyo.AddComponent <Soudaisyo>();
                            chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                            //soudaisyo
                            if (soudaisyo == int.Parse(chldBusyo.name))
                            {
                                chldBusyo.GetComponent <Soudaisyo>().OnClick();
                            }

                            //Add Kamon
                            string     KamonPath = "Prefabs/Jinkei/Kamon";
                            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                            kamon.transform.SetParent(chldBusyo.transform);
                            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                            kamon.transform.localPosition = new Vector2(-15, -12);
                            int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                            if (daimyoId == 0)
                            {
                                daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                            }
                            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                            kamon.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            //Add Heisyu
                            string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                            heisyuObj.transform.SetParent(chldBusyo.transform, false);
                            heisyuObj.transform.localPosition = new Vector2(10, -10);
                            heisyuObj.transform.SetAsFirstSibling();
                        }

                        //Disable 3,4,5,6,9,10,15,16,19,20,23,24,25
                    }
                    else
                    {
                        obs.GetComponent <Image> ().enabled = false;

                        if (obs.transform.IsChildOf(obs.transform))
                        {
                            foreach (Transform n in obs.transform)
                            {
                                GameObject.Destroy(n.gameObject);
                            }
                        }
                    }
                }
                UnitOnScrollView(jinkeiBusyo_list);

                //Button Color
                jinkeiForm.ButtonColorChanger("Gyorin");


                //鶴翼
            }
            else if (jinkei == 2)
            {
                int soudaisyo = PlayerPrefs.GetInt("soudaisyo2");

                foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
                {
                    //Enable 3,4,5,7,8,11,12,17,18,23,24,25
                    if (obs.name == "Slot3" || obs.name == "Slot4" || obs.name == "Slot5" || obs.name == "Slot7" ||
                        obs.name == "Slot8" || obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot17" ||
                        obs.name == "Slot18" || obs.name == "Slot23" || obs.name == "Slot24" || obs.name == "Slot25")
                    {
                        obs.GetComponent <Image>().enabled = true;
                        string mapId = "2map" + obs.name.Substring(4);
                        if (PlayerPrefs.HasKey(mapId))
                        {
                            int busyoId = PlayerPrefs.GetInt(mapId);
                            jinkeiBusyo_list.Add(busyoId.ToString());

                            //Instantiate
                            string     path      = "Prefabs/Player/Unit/BusyoUnit";
                            GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.parent     = obs.transform;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.localScale = new Vector2(4, 4);
                            chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);
                            chldBusyo.transform.localPosition = new Vector3(0, 0, 0);

                            //Button
                            chldBusyo.AddComponent <Button>();
                            chldBusyo.AddComponent <Soudaisyo>();
                            chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                            //soudaisyo
                            if (soudaisyo == int.Parse(chldBusyo.name))
                            {
                                chldBusyo.GetComponent <Soudaisyo>().OnClick();
                            }

                            //Add Kamon
                            string     KamonPath = "Prefabs/Jinkei/Kamon";
                            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                            kamon.transform.SetParent(chldBusyo.transform);
                            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                            kamon.transform.localPosition = new Vector2(-15, -12);
                            int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                            if (daimyoId == 0)
                            {
                                daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                            }
                            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                            kamon.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            //Add Heisyu
                            string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                            heisyuObj.transform.SetParent(chldBusyo.transform, false);
                            heisyuObj.transform.localPosition = new Vector2(10, -10);
                            heisyuObj.transform.SetAsFirstSibling();
                        }

                        //Disable 1,2,6,9,10,13,14,15,16,19,20,21,22
                    }
                    else
                    {
                        obs.GetComponent <Image>().enabled = false;

                        if (obs.transform.IsChildOf(obs.transform))
                        {
                            foreach (Transform n in obs.transform)
                            {
                                GameObject.Destroy(n.gameObject);
                            }
                        }
                    }
                }
                UnitOnScrollView(jinkeiBusyo_list);

                //Button Color
                jinkeiForm.ButtonColorChanger("Kakuyoku");
            }
            else if (jinkei == 3)
            {
                int soudaisyo = PlayerPrefs.GetInt("soudaisyo3");

                foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
                {
                    //Enable 3,7,8,9,11,12,14,15,16,20,21,25
                    if (obs.name == "Slot3" || obs.name == "Slot7" || obs.name == "Slot8" || obs.name == "Slot9" ||
                        obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot14" || obs.name == "Slot15" ||
                        obs.name == "Slot16" || obs.name == "Slot20" || obs.name == "Slot21" || obs.name == "Slot25")
                    {
                        obs.GetComponent <Image>().enabled = true;
                        string mapId = "3map" + obs.name.Substring(4);
                        if (PlayerPrefs.HasKey(mapId))
                        {
                            int busyoId = PlayerPrefs.GetInt(mapId);
                            jinkeiBusyo_list.Add(busyoId.ToString());

                            //Instantiate
                            string     path      = "Prefabs/Player/Unit/BusyoUnit";
                            GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.parent     = obs.transform;
                            chldBusyo.name                 = busyoId.ToString();
                            chldBusyo.transform.localScale = new Vector2(4, 4);
                            chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);
                            chldBusyo.transform.localPosition = new Vector3(0, 0, 0);

                            //Button
                            chldBusyo.AddComponent <Button>();
                            chldBusyo.AddComponent <Soudaisyo>();
                            chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                            //soudaisyo
                            if (soudaisyo == int.Parse(chldBusyo.name))
                            {
                                chldBusyo.GetComponent <Soudaisyo>().OnClick();
                            }

                            //Add Kamon
                            string     KamonPath = "Prefabs/Jinkei/Kamon";
                            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                            kamon.transform.SetParent(chldBusyo.transform);
                            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                            kamon.transform.localPosition = new Vector2(-15, -12);
                            int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                            if (daimyoId == 0)
                            {
                                daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                            }
                            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                            kamon.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            //Add Heisyu
                            string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                            heisyuObj.transform.SetParent(chldBusyo.transform, false);
                            heisyuObj.transform.localPosition = new Vector2(10, -10);
                            heisyuObj.transform.SetAsFirstSibling();
                        }

                        //Disable 1,2,4,5,6,10,13,17,18,19,22,23,24
                    }
                    else
                    {
                        obs.GetComponent <Image>().enabled = false;
                        if (obs.transform.IsChildOf(obs.transform))
                        {
                            foreach (Transform n in obs.transform)
                            {
                                GameObject.Destroy(n.gameObject);
                            }
                        }
                    }
                }
                UnitOnScrollView(jinkeiBusyo_list);

                //Button Color
                jinkeiForm.ButtonColorChanger("Engetsu");
            }
            else if (jinkei == 4)
            {
                int soudaisyo = PlayerPrefs.GetInt("soudaisyo4");

                foreach (GameObject obs in  GameObject.FindGameObjectsWithTag("Slot"))
                {
                    //Enable 1,2,7,8,12,13,14,18,19,20,24,25
                    if (obs.name == "Slot1" || obs.name == "Slot2" || obs.name == "Slot7" || obs.name == "Slot8" ||
                        obs.name == "Slot12" || obs.name == "Slot13" || obs.name == "Slot14" || obs.name == "Slot18" ||
                        obs.name == "Slot19" || obs.name == "Slot20" || obs.name == "Slot24" || obs.name == "Slot25")
                    {
                        obs.GetComponent <Image>().enabled = true;
                        string mapId = "4map" + obs.name.Substring(4);
                        if (PlayerPrefs.HasKey(mapId))
                        {
                            int busyoId = PlayerPrefs.GetInt(mapId);
                            jinkeiBusyo_list.Add(busyoId.ToString());

                            //Instantiate
                            string     path      = "Prefabs/Player/Unit/BusyoUnit";
                            GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                            chldBusyo.name = busyoId.ToString();
                            chldBusyo.transform.SetParent(obs.transform);
                            chldBusyo.name = busyoId.ToString();
                            chldBusyo.transform.localScale = new Vector2(4, 4);
                            chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);
                            chldBusyo.transform.localPosition = new Vector3(0, 0, 0);

                            //Button
                            chldBusyo.AddComponent <Button>();
                            chldBusyo.AddComponent <Soudaisyo>();
                            chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                            //soudaisyo
                            if (soudaisyo == int.Parse(chldBusyo.name))
                            {
                                chldBusyo.GetComponent <Soudaisyo>().OnClick();
                            }

                            //Add Kamon
                            string     KamonPath = "Prefabs/Jinkei/Kamon";
                            GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                            kamon.transform.SetParent(chldBusyo.transform);
                            kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                            kamon.transform.localPosition = new Vector2(-15, -12);
                            int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                            if (daimyoId == 0)
                            {
                                daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                            }
                            string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                            kamon.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            //Add Heisyu
                            string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                            string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                            GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                            heisyuObj.transform.SetParent(chldBusyo.transform, false);
                            heisyuObj.transform.localPosition = new Vector2(10, -10);
                            heisyuObj.transform.SetAsFirstSibling();
                        }

                        //Disable 3,4,5,6,9,10,11,15,16,17,21,22,23
                    }
                    else
                    {
                        obs.GetComponent <Image>().enabled = false;
                        if (obs.transform.IsChildOf(obs.transform))
                        {
                            foreach (Transform n in obs.transform)
                            {
                                GameObject.Destroy(n.gameObject);
                            }
                        }
                    }
                }
                UnitOnScrollView(jinkeiBusyo_list);

                //Button Color
                jinkeiForm.ButtonColorChanger("Gankou");
            }

            JinkeiPowerEffection powerEffection = new JinkeiPowerEffection();
            powerEffection.UpdateSenryoku();

            StatusView();
            SenryokuView();
        }
        else
        {
            //retry tutorial
            //Kamon
            int    myDaimyo           = 1;
            string myDaimyoStatusPath = "Prefabs/Kamon/" + myDaimyo.ToString();
            GameObject.Find("KamonView").GetComponent <Image>().sprite =
                Resources.Load(myDaimyoStatusPath, typeof(Sprite)) as Sprite;

            //jinkei limit update
            GameObject.Find("jinkeiLimitValue").GetComponent <Text>().text = 3.ToString();

            int jinkei = 1;
            totalHpValue  = GameObject.Find("totalHpValue").gameObject;
            totalAtkValue = GameObject.Find("totalAtkValue").gameObject;
            totalDfcValue = GameObject.Find("totalDfcValue").gameObject;
            KakuteiButton = GameObject.Find("KakuteiButton").gameObject;
            KakuteiButton.GetComponent <Jinkei>().selectedJinkei = jinkei;
            BusyoInfoGet     busyoScript = new BusyoInfoGet();
            JinkeiFormButton jinkeiForm  = new JinkeiFormButton();

            int soudaisyo = 19;
            foreach (GameObject obs in GameObject.FindGameObjectsWithTag("Slot"))
            {
                //Enable 1,2,7,8,11,12,13,14,17,18,21,22
                if (obs.name == "Slot1" || obs.name == "Slot2" || obs.name == "Slot7" || obs.name == "Slot8" ||
                    obs.name == "Slot11" || obs.name == "Slot12" || obs.name == "Slot13" || obs.name == "Slot14" ||
                    obs.name == "Slot17" || obs.name == "Slot18" || obs.name == "Slot21" || obs.name == "Slot22")
                {
                    obs.GetComponent <Image>().enabled = true;

                    if (obs.name == "Slot12")
                    {
                        int busyoId = 19;

                        //Instantiate
                        string     path      = "Prefabs/Player/Unit/BusyoUnit";
                        GameObject chldBusyo = Instantiate(Resources.Load(path)) as GameObject;
                        chldBusyo.name                 = busyoId.ToString();
                        chldBusyo.transform.parent     = obs.transform;
                        chldBusyo.name                 = busyoId.ToString();
                        chldBusyo.transform.localScale = new Vector2(4, 4);
                        chldBusyo.AddComponent <Senryoku>().GetPlayerSenryoku(chldBusyo.name);

                        chldBusyo.transform.localPosition = new Vector3(0, 0, 0);

                        //Button
                        chldBusyo.AddComponent <Button>();
                        chldBusyo.AddComponent <Soudaisyo>();
                        chldBusyo.GetComponent <Button>().onClick.AddListener(chldBusyo.GetComponent <Soudaisyo>().OnClick);

                        //soudaisyo
                        if (soudaisyo == int.Parse(chldBusyo.name))
                        {
                            chldBusyo.GetComponent <Soudaisyo>().OnClick();
                        }

                        //Add Kamon
                        string     KamonPath = "Prefabs/Jinkei/Kamon";
                        GameObject kamon     = Instantiate(Resources.Load(KamonPath)) as GameObject;
                        kamon.transform.SetParent(chldBusyo.transform);
                        kamon.transform.localScale    = new Vector2(0.1f, 0.1f);
                        kamon.transform.localPosition = new Vector2(-15, -12);
                        int daimyoId = busyoScript.getDaimyoId(int.Parse(chldBusyo.name));
                        if (daimyoId == 0)
                        {
                            daimyoId = busyoScript.getDaimyoHst(int.Parse(chldBusyo.name));
                        }
                        string imagePath = "Prefabs/Kamon/MyDaimyoKamon/" + daimyoId.ToString();
                        kamon.GetComponent <Image>().sprite =
                            Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                        //Add Heisyu
                        string     heisyu     = busyoScript.getHeisyu(int.Parse(chldBusyo.name));
                        string     heisyuPath = "Prefabs/Jinkei/" + heisyu;
                        GameObject heisyuObj  = Instantiate(Resources.Load(heisyuPath)) as GameObject;
                        heisyuObj.transform.SetParent(chldBusyo.transform, false);
                        heisyuObj.transform.localPosition = new Vector2(10, -10);
                        heisyuObj.transform.SetAsFirstSibling();
                    }

                    //Disable 3,4,5,6,9,10,15,16,19,20,23,24,25
                }
                else
                {
                    obs.GetComponent <Image>().enabled = false;

                    if (obs.transform.IsChildOf(obs.transform))
                    {
                        foreach (Transform n in obs.transform)
                        {
                            GameObject.Destroy(n.gameObject);
                        }
                    }
                }
            }
            UnitOnScrollViewTutorial();

            //Button Color
            jinkeiForm.ButtonColorChanger("Gyorin");
        }
    }