Esempio n. 1
0
    public int getStsAndMakeInstance(int jinkei, int mapId, float rainMinusRatio, float snowMinusRatio)
    {
        //Get Status
        string map     = jinkei.ToString() + "map" + mapId;
        int    busyoId = PlayerPrefs.GetInt(map);

        string busyoString = busyoId.ToString();
        int    lv          = PlayerPrefs.GetInt(busyoString);

        StatusGet    sts         = new StatusGet();
        BusyoInfoGet busyoInfo   = new BusyoInfoGet();
        int          shipId      = busyoInfo.getShipId(busyoId);
        int          hp          = sts.getHp(busyoId, lv);
        int          atk         = sts.getAtk(busyoId, lv);
        int          dfc         = sts.getDfc(busyoId, lv);
        int          spd         = sts.getSpd(busyoId, lv);
        string       busyoName   = sts.getBusyoName(busyoId);
        ArrayList    senpouArray = sts.getSenpou(busyoId, false);

        //Make Average Senpou Lv
        totalSenpouLv = totalSenpouLv + (int)senpouArray[8];

        //Weather Minus
        if (rainMinusRatio != 0 || snowMinusRatio != 0)
        {
            float tmp = (float)spd * 0.5f;
            if (tmp < 1)
            {
                tmp = 1;
            }
            spd = Mathf.FloorToInt(tmp);
        }

        //Soudaisyo
        if (busyoId == soudaisyo)
        {
            soudaisyoHp  = hp;
            soudaisyoAtk = atk;
            soudaisyoDfc = dfc;
            soudaisyoSpd = spd / 10;
        }

        //Boubi
        int boubi = 0;

        if (activeStageId == 0)
        {
            //Passive
            boubi = PlayerPrefs.GetInt("activeBoubi", 0);
        }

        //View Object & pass status to it.
        PlayerInstance inst = new PlayerInstance();

        inst.makeKaisenInstance(busyoId, shipId, mapId, hp, atk, dfc, spd, senpouArray, busyoName, soudaisyo, boubi, false, 0, 0);

        return(busyoId);
    }
Esempio n. 2
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));
            }
        }
    }
Esempio n. 3
0
    public void getEnemyStsAndMakeInstance(int linkNo, int mapId, float rainMinusRatio, float snowMinusRatio)
    {
        string map     = "emap" + mapId;
        int    busyoId = PlayerPrefs.GetInt(map);

        int activeBusyoLv  = PlayerPrefs.GetInt("activeBusyoLv");
        int activeButaiQty = PlayerPrefs.GetInt("activeButaiQty");
        int activeButaiLv  = PlayerPrefs.GetInt("activeButaiLv");

        StatusGet    sts       = new StatusGet();
        BusyoInfoGet info      = new BusyoInfoGet();
        int          shipId    = info.getShipId(busyoId);
        int          hp        = sts.getHp(busyoId, activeBusyoLv);
        int          atk       = sts.getAtk(busyoId, activeBusyoLv);
        int          dfc       = sts.getDfc(busyoId, activeBusyoLv);
        int          spd       = sts.getSpd(busyoId, activeBusyoLv);
        string       busyoName = sts.getBusyoName(busyoId);
        string       heisyu    = sts.getHeisyu(busyoId);

        int playerBusyoQty = PlayerPrefs.GetInt("jinkeiBusyoQty");

        aveSenpouLv = Mathf.CeilToInt(totalSenpouLv / playerBusyoQty);
        ArrayList senpouArray = sts.getEnemySenpou(busyoId, aveSenpouLv, "");

        //Weather Minus
        if (rainMinusRatio != 0 || snowMinusRatio != 0)
        {
            float tmp = (float)spd * 0.5f;
            if (tmp < 1)
            {
                tmp = 1;
            }
            spd = Mathf.FloorToInt(tmp);
        }

        bool enemyTaisyoFlg = false;

        if (busyoId == enemySoudaisyo)
        {
            enemyTaisyoFlg = true;
        }

        //View Object & pass status to it.
        EnemyInstance inst = new EnemyInstance();

        inst.makeKaisenInstance(mapId, busyoId, shipId, activeButaiLv, heisyu, activeButaiQty, hp, atk, dfc, spd, busyoName, linkNo, enemyTaisyoFlg, senpouArray);
    }
Esempio n. 4
0
    public int getHei(int busyoId, int activeBusyoLv, int activeButaiQty, int activeButaiLv)
    {
        int hei = 0;

        StatusGet    sts        = new StatusGet();
        BusyoInfoGet info       = new BusyoInfoGet();
        string       TaisyoType = info.getHeisyu(busyoId);
        int          hp         = sts.getHp(busyoId, activeBusyoLv);

        hp = hp * 100;

        EnemyInstance enemyIns = new EnemyInstance();
        int           chldHp   = activeButaiQty * enemyIns.getChildStatus(activeButaiLv, TaisyoType, 0);

        hei = hp + chldHp;

        return(hei);
    }
Esempio n. 5
0
    void Start()
    {
        BusyoInfoGet busyoInfoScript = new BusyoInfoGet();
        string       busyoName       = busyoInfoScript.getName(int.Parse(name));
        string       busyoRank       = busyoInfoScript.getRank(int.Parse(name));

        transform.FindChild("Text").GetComponent <Text> ().text = busyoName;
        transform.FindChild("Rank").GetComponent <Text> ().text = busyoRank;

        if (Application.loadedLevelName != "preKaisen")
        {
            string imagePath = "Prefabs/Player/Sprite/unit" + name;
            GetComponent <Image> ().sprite =
                Resources.Load(imagePath, typeof(Sprite)) as Sprite;
        }
        else
        {
            transform.FindChild("Text").GetComponent <Text>().fontSize = 70;
            Color white = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); //white
            transform.FindChild("Text").GetComponent <Text>().color = white;
        }
    }
Esempio n. 6
0
    public void playerEngunInstance(string playerEngunList, float mntMinusRatio, float seaMinusRatio, float rainMinusRatio, float snowMinusRatio)
    {
        List <string> daimyoEnguniList = new List <string> ();

        char[] delimiterChars  = { ':' };
        char[] delimiterChars2 = { '-' };
        if (playerEngunList.Contains(":"))
        {
            daimyoEnguniList = new List <string> (playerEngunList.Split(delimiterChars));
        }
        else
        {
            daimyoEnguniList.Add(playerEngunList);
        }

        for (int i = 0; i < daimyoEnguniList.Count; i++)
        {
            StatusGet     sts = new StatusGet();
            string        daimyoEngunString = daimyoEnguniList[i];
            List <string> unitEnguniList    = new List <string> ();
            unitEnguniList = new List <string> (daimyoEngunString.Split(delimiterChars2));
            int    busyoId = int.Parse(unitEnguniList[1]);
            string heisyu  = sts.getHeisyu(busyoId);

            if (busyoId != 0)
            {
                int busyoLv  = int.Parse(unitEnguniList[2]);
                int butaiQty = int.Parse(unitEnguniList[3]);
                int butaiLv  = int.Parse(unitEnguniList[4]);


                int       hp          = sts.getHp(busyoId, busyoLv);
                int       atk         = sts.getAtk(busyoId, busyoLv);
                int       dfc         = sts.getDfc(busyoId, busyoLv);
                int       spd         = sts.getSpd(busyoId, busyoLv);
                string    busyoName   = sts.getBusyoName(busyoId);
                ArrayList senpouArray = sts.getSenpou(busyoId, true);

                if (mntMinusRatio != 0)
                {
                    if (heisyu == "KB")
                    {
                        float tmp = (float)spd * mntMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        spd = Mathf.FloorToInt(tmp);
                    }
                }
                else if (seaMinusRatio != 0)
                {
                    if (heisyu == "TP")
                    {
                        float tmp = (float)dfc * seaMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp = (float)dfc * seaMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp);
                    }
                }
                if (rainMinusRatio != 0)
                {
                    if (heisyu == "TP")
                    {
                        float tmp = (float)atk * rainMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        atk = Mathf.FloorToInt(tmp);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp = (float)atk * rainMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        atk = Mathf.FloorToInt(tmp);
                    }
                }
                else if (snowMinusRatio != 0)
                {
                    float tmp = (float)spd * 0.5f;
                    if (tmp < 1)
                    {
                        tmp = 1;
                    }
                    spd = Mathf.FloorToInt(tmp);

                    if (heisyu == "TP")
                    {
                        float tmp2 = (float)atk * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        atk = Mathf.FloorToInt(tmp2);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp2 = (float)atk * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        atk = Mathf.FloorToInt(tmp2);
                    }
                    else if (heisyu == "KB")
                    {
                        float tmp2 = (float)dfc * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp2);
                    }
                }

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                if (Application.loadedLevelName != "kaisen")
                {
                    inst.makeEngunInstance(busyoId, hp, atk, dfc, spd, senpouArray, busyoName, butaiQty, butaiLv);
                }
                else
                {
                    BusyoInfoGet busyoScript = new BusyoInfoGet();
                    int          shipId      = busyoScript.getShipId(busyoId);
                    inst.makeKaisenInstance(busyoId, shipId, 25, hp, atk, dfc, spd, senpouArray, busyoName, butaiQty, butaiLv, true, butaiQty, butaiLv);
                }
            }
        }

        //auto check
        if (GameObject.Find("AutoBtn"))
        {
            if (GameObject.Find("AutoBtn").GetComponent <AutoAttack>().onFlg)
            {
                AutoAttack autoScript = new AutoAttack();
                autoScript.changeAutoScript();
            }
        }

        Message msg = new Message();

        msg.makeKassenMessage(msg.getMessage(130));
    }
Esempio n. 7
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();
        }
    }
Esempio n. 8
0
    public void createSyoguView(string busyoId)
    {
        int lv = PlayerPrefs.GetInt(busyoId);

        Color ngImageColor = new Color(40f / 255f, 40f / 255f, 40f / 255f, 180f / 255f);
        Color ngTextColor  = new Color(90f / 255f, 90f / 255f, 90f / 255f, 90f / 255f);
        Color okImageColor = new Color(255f / 255f, 255f / 255f, 255f / 255f, 150f / 255f);
        Color okTextColor  = new Color(40f / 255f, 40f / 255f, 0f / 255f, 255f / 255f);

        GameObject kanjyo  = GameObject.Find("kanjyo").gameObject;
        GameObject tsuihou = GameObject.Find("tsuihou").gameObject;

        int daimyoBusyoId = PlayerPrefs.GetInt("myDaimyoBusyo");

        if (busyoId == daimyoBusyoId.ToString())
        {
            kanjyo.GetComponent <Image> ().color = ngImageColor;
            kanjyo.transform.FindChild("Text").GetComponent <Text> ().color = ngTextColor;
            kanjyo.GetComponent <Button> ().enabled = false;

            tsuihou.GetComponent <Image> ().color = ngImageColor;
            tsuihou.transform.FindChild("Text").GetComponent <Text> ().color = ngTextColor;
            tsuihou.GetComponent <Button> ().enabled = false;
        }
        else
        {
            string addLvTmp = "addlv" + busyoId.ToString();
            int    maxLv    = 100 + PlayerPrefs.GetInt(addLvTmp);

            if (lv != maxLv)
            {
                kanjyo.GetComponent <BusyoStatusButton> ().pa_lv = lv;
                kanjyo.GetComponent <Image> ().color             = okImageColor;
                kanjyo.transform.FindChild("Text").GetComponent <Text> ().color = okTextColor;
                kanjyo.GetComponent <Button> ().enabled = true;
            }
            else
            {
                kanjyo.GetComponent <Image> ().color = ngImageColor;
                kanjyo.transform.FindChild("Text").GetComponent <Text> ().color = ngTextColor;
                kanjyo.GetComponent <Button> ().enabled = false;
            }

            tsuihou.GetComponent <Image> ().color = okImageColor;
            tsuihou.transform.FindChild("Text").GetComponent <Text> ().color = okTextColor;
            tsuihou.GetComponent <Button> ().enabled = true;
        }

        GameObject kanni  = GameObject.Find("kanni").gameObject;
        GameObject jyosyu = GameObject.Find("jyosyu").gameObject;
        GameObject syugyo = GameObject.Find("syugyo").gameObject;
        GameObject gokui  = GameObject.Find("gokui").gameObject;

        kanni.GetComponent <RonkouKousyoMenu>().busyoId  = busyoId;
        jyosyu.GetComponent <RonkouKousyoMenu>().busyoId = busyoId;
        syugyo.GetComponent <RonkouKousyoMenu>().busyoId = busyoId;
        gokui.GetComponent <RonkouKousyoMenu>().busyoId  = busyoId;

        //Kanni
        string kanniTmp    = "kanni" + busyoId;
        Kanni  kanniScript = new Kanni();

        if (PlayerPrefs.HasKey(kanniTmp))
        {
            int kanniId = PlayerPrefs.GetInt(kanniTmp);
            if (kanniId != 0)
            {
                foreach (Transform n in kanni.transform)
                {
                    if (n.name == "KanniName")
                    {
                        Destroy(n.gameObject);
                    }
                }
                kanni.GetComponent <RonkouKousyoMenu> ().kanniId = kanniId;
                string     path      = "Prefabs/Busyo/KanniName";
                GameObject kanniName = Instantiate(Resources.Load(path)) as GameObject;
                kanniName.transform.SetParent(kanni.transform);
                kanniName.transform.localScale    = new Vector2(0.12f, 0.12f);
                kanniName.transform.localPosition = new Vector2(0, 0);
                kanniName.name = "KanniName";

                string kanniNameString = kanniScript.getKanni(kanniId);
                string kanniIkai       = kanniScript.getIkai(kanniId);
                kanniName.transform.FindChild("value").GetComponent <Text>().text = kanniIkai + "\n" + kanniNameString;

                string effectLabel = kanniScript.getEffectLabel(kanniId);
                int    effect      = kanniScript.getEffect(kanniId);
                kanniName.transform.FindChild("effectLabel").GetComponent <Text>().text = effectLabel;
                kanniName.transform.FindChild("effectValue").GetComponent <Text>().text = "+" + effect.ToString() + "%";

                kanni.transform.FindChild("Text").GetComponent <Text> ().enabled = false;
            }
            else
            {
                foreach (Transform n in kanni.transform)
                {
                    if (n.name == "KanniName")
                    {
                        Destroy(n.gameObject);
                    }
                }

                kanni.GetComponent <RonkouKousyoMenu>().kanniId = 0;
                kanni.transform.FindChild("Text").GetComponent <Text>().enabled = true;
            }
        }
        else
        {
            foreach (Transform n in kanni.transform)
            {
                if (n.name == "KanniName")
                {
                    Destroy(n.gameObject);
                }
            }

            kanni.GetComponent <RonkouKousyoMenu> ().kanniId = 0;
            kanni.transform.FindChild("Text").GetComponent <Text> ().enabled = true;
        }

        //Jyosyu
        string jyosyuTmp = "jyosyuBusyo" + busyoId;

        if (PlayerPrefs.HasKey(jyosyuTmp))
        {
            BusyoInfoGet busyoInfo = new BusyoInfoGet();
            string       busyoName = busyoInfo.getName(int.Parse(busyoId));
            jyosyu.GetComponent <RonkouKousyoMenu>().jyosyuName = busyoName;

            int kuniId = PlayerPrefs.GetInt(jyosyuTmp);

            if (kuniId != 0)
            {
                foreach (Transform n in jyosyu.transform)
                {
                    if (n.name == "JyosyuName")
                    {
                        Destroy(n.gameObject);
                    }
                }

                KuniInfo kuni     = new KuniInfo();
                string   kuniName = kuni.getKuniName(kuniId);

                string jyosyuHeiTmp = "jyosyuHei" + busyoId;
                int    jyosyuHei    = PlayerPrefs.GetInt(jyosyuHeiTmp);

                jyosyu.GetComponent <RonkouKousyoMenu>().jyosyuKuniId = kuniId;
                string     jyosyuPath = "Prefabs/Busyo/JyosyuName";
                GameObject jyosyuName = Instantiate(Resources.Load(jyosyuPath)) as GameObject;
                jyosyuName.transform.SetParent(jyosyu.transform);
                jyosyuName.transform.localScale    = new Vector2(0.12f, 0.12f);
                jyosyuName.transform.localPosition = new Vector2(0, 0);
                jyosyuName.name = "JyosyuName";

                jyosyuName.transform.FindChild("value").GetComponent <Text>().text       = kuniName;
                jyosyuName.transform.FindChild("effectValue").GetComponent <Text>().text = "+" + jyosyuHei.ToString();

                jyosyu.transform.FindChild("Text").GetComponent <Text> ().enabled = false;
            }
        }
        else
        {
            foreach (Transform n in jyosyu.transform)
            {
                if (n.name == "JyosyuName")
                {
                    Destroy(n.gameObject);
                }
            }
            jyosyu.GetComponent <RonkouKousyoMenu> ().jyosyuKuniId            = 0;
            jyosyu.transform.FindChild("Text").GetComponent <Text> ().enabled = true;
        }
    }
Esempio n. 9
0
    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);
    }
Esempio n. 10
0
	//doramatic charactor

	// Use this for initialization
	void Start () {
		//map生成
		Instantiate(mapPrefab);
		Instantiate(treePrefab);
		Instantiate(wallPrefab);


		/*プレイヤー配置*/
	
		//ユーザ陣形データのロード
		int jinkei =PlayerPrefs.GetInt("jinkei",0);

		//1.魚麟
		if (jinkei == 1) {
			if(PlayerPrefs.HasKey("1map1")){
				int mapId = 1;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map2")){
				int mapId = 2;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map7")){
				int mapId = 7;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map8")){
				int mapId = 8;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map11")){
				int mapId = 11;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map12")){
				int mapId = 12;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map13")){
				int mapId = 13;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map14")){
				int mapId = 14;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map17")){
				int mapId = 17;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map18")){
				int mapId = 18;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map21")){
				int mapId = 21;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("1map22")){
				int mapId = 22;
				getStsAndMakeInstance(jinkei,mapId);
			}
		


		//2.鶴翼
		}else if(jinkei == 2){
			if(PlayerPrefs.HasKey("2map3")){
				int mapId = 3;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map4")){
				int mapId = 4;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map5")){
				int mapId = 5;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map7")){
				int mapId = 7;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map8")){
				int mapId = 8;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map11")){
				int mapId = 11;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map12")){
				int mapId = 12;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map17")){
				int mapId = 17;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map18")){
				int mapId = 18;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map23")){
				int mapId = 23;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map24")){
				int mapId = 24;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("2map25")){
				int mapId = 25;
				getStsAndMakeInstance(jinkei,mapId);
			}

		}
		//3.偃月
		else if(jinkei == 3){
			if(PlayerPrefs.HasKey("3map3")){
				int mapId = 3;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map7")){
				int mapId = 7;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map8")){
				int mapId = 8;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map9")){
				int mapId = 9;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map11")){
				int mapId = 11;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map12")){
				int mapId = 12;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map14")){
				int mapId = 14;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map15")){
				int mapId = 15;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map16")){
				int mapId = 16;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map20")){
				int mapId = 20;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map21")){
				int mapId = 21;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("3map25")){
				int mapId = 25;
				getStsAndMakeInstance(jinkei,mapId);
			}
		}

		//4.雁行
		else if(jinkei == 4){
			if(PlayerPrefs.HasKey("4map1")){
				int mapId = 1;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map2")){
				int mapId = 2;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map7")){
				int mapId = 7;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map8")){
				int mapId = 8;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map12")){
				int mapId = 12;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map13")){
				int mapId = 13;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map14")){
				int mapId = 14;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map18")){
				int mapId = 18;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map19")){
				int mapId = 19;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map20")){
				int mapId = 20;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map24")){
				int mapId = 24;
				getStsAndMakeInstance(jinkei,mapId);
			}
			if(PlayerPrefs.HasKey("4map25")){
				int mapId = 25;
				getStsAndMakeInstance(jinkei,mapId);
			}
		}


		/*エネミー配置*/
		//stageId取得しマスタ判別
		int tempStageId = PlayerPrefs.GetInt("activeStageId",0);
		int kuniId = PlayerPrefs.GetInt("activeKuniId",0);

		Entity_stage_mst stageMst  = Resources.Load ("Data/stage_mst") as Entity_stage_mst;

		//y=10(X-1)+z-1
		int stageId = 10*(kuniId - 1) + tempStageId;

		//Jinkei Random
		List<int> jinkeiList = new List<int> (){1,2,3,4};
		int enemyJinkei = UnityEngine.Random.Range(1,jinkeiList.Count + 1);

		/*Dynamic Enemy Setting Start*/
		int activeDaimyoId = PlayerPrefs.GetInt("activeDaimyoId");
		int activeBusyoQty = PlayerPrefs.GetInt ("activeBusyoQty");
		int activeBusyoLv = PlayerPrefs.GetInt ("activeBusyoLv");
		int activeButaiQty = PlayerPrefs.GetInt ("activeButaiQty");
		int activeButaiLv = PlayerPrefs.GetInt ("activeButaiLv");
		Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst;
		int daimyoBusyoId = daimyoMst.param[activeDaimyoId-1].busyoId;

		//Dimyo Setting
		int taisyoMapId = 0;
		List<int> mapList = new List<int>();

		if (enemyJinkei == 1) {
			taisyoMapId = 15;
			mapList = new List<int>(){4,5,8,9,12,13,14,18,19,24,25};

		}else if (enemyJinkei == 2) {
			taisyoMapId = 15;
			mapList = new List<int>(){1,2,3,8,9,14,18,19,21,22,23};

		}else if (enemyJinkei == 3) {
			taisyoMapId = 14;
			mapList = new List<int>(){1,5,6,10,11,12,15,17,18,19,23};
				
		}else if (enemyJinkei == 4) {
			taisyoMapId = 14;
			mapList = new List<int>(){4,5,8,9,12,13,16,17,18,21,22};

		}
		
		StatusGet sts = new StatusGet();
		int hp = sts.getHp(daimyoBusyoId,activeBusyoLv);
		int atk = sts.getAtk(daimyoBusyoId,activeBusyoLv);
		int dfc = sts.getDfc(daimyoBusyoId,activeBusyoLv);
		int spd = sts.getSpd(daimyoBusyoId,activeBusyoLv);
		
		BusyoInfoGet info = new BusyoInfoGet();
		String daimyoBusyoName = info.getName(daimyoBusyoId);
		String daimyoType = info.getHeisyu(daimyoBusyoId);
		
		EnemyInstance inst = new EnemyInstance();
		inst.makeInstance(taisyoMapId, daimyoBusyoId, activeButaiLv, daimyoType, activeButaiQty, hp, atk, dfc, spd, daimyoBusyoName);

		//Busyo Setting
		//Make busyo list
		Entity_busyo_mst busyoMst  = Resources.Load ("Data/busyo_mst") as Entity_busyo_mst;
		List<int> busyoList = new List<int> ();

		for(int i=0; i<busyoMst.param.Count; i++){
			int busyoId = busyoMst.param[i].id;
			int daimyoId = busyoMst.param[i].daimyoId;

			if(daimyoId == activeDaimyoId){

				if(busyoId != daimyoBusyoId){
					busyoList.Add (busyoId);
				}
			}
		}

		//Random Shuffle
		for (int i = 0; i < busyoList.Count; i++) {
			int temp = busyoList[i];
			int randomIndex = UnityEngine.Random.Range(0, busyoList.Count);
			busyoList[i] = busyoList[randomIndex];
			busyoList[randomIndex] = temp;
		}

		for (int i = 0; i < mapList.Count; i++) {
			int temp = mapList[i];
			int randomIndex = UnityEngine.Random.Range(0, mapList.Count);
			mapList[i] = mapList[randomIndex];
			mapList[randomIndex] = temp;
		}

		for(int j=0; j<activeBusyoQty-1; j++){
			int randomBusyoId = busyoList[j];
			int mapId = mapList[j];


			//Status
			if(randomBusyoId !=0){
				int busyoHp = sts.getHp(randomBusyoId,activeBusyoLv);
				int busyoAtk = sts.getAtk(randomBusyoId,activeBusyoLv);
				int busyoDfc = sts.getDfc(randomBusyoId,activeBusyoLv);
				int busyoSpd = sts.getSpd(randomBusyoId,activeBusyoLv);

				String busyoName = info.getName(randomBusyoId);
				String busyoType = info.getHeisyu(randomBusyoId);

				inst.makeInstance(mapId, randomBusyoId, activeButaiLv, busyoType, activeButaiQty, busyoHp, busyoAtk, busyoDfc, busyoSpd, busyoName);
			}
		}

		/*Dynamic Enemy Setting Finish*/

		//合戦開始エフェクト
		string pathBack = "Prefabs/PreKassen/backGround";
		GameObject back = Instantiate(Resources.Load (pathBack)) as GameObject;
		back.transform.localScale = new Vector2 (30, 15);

		string pathLight = "Prefabs/PreKassen/lightning";
		GameObject light = Instantiate(Resources.Load (pathLight)) as GameObject;
		light.transform.localScale = new Vector2 (10, 10);



	}
Esempio n. 11
0
	public void OnClick(){

		if (close.GetComponent<CloseBoard> ().kuniId != kuniId) {
			close.GetComponent<CloseBoard> ().kuniId = kuniId;

			/*Status*/
			//Common
			GameObject kuniIconView = GameObject.Find ("KuniIconView").gameObject;
			SendParam script = kuniIconView.transform.FindChild (kuniId.ToString ()).GetComponent<SendParam> ();
			KuniInfo kuni = new KuniInfo ();
			Daimyo daimyo = new Daimyo ();
			Gaikou gaikou = new Gaikou ();
			List<int> targetKuniList = new List<int> ();
			targetKuniList = kuni.getMappingKuni (kuniId);
			char[] delimiterChars = { ',' };

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

			//Daimyo Name
			daimyoNameObj.transform.FindChild ("Value").GetComponent<Text> ().text = daimyoName;

			//Kuni Name
			GameObject kuniNameObj = status.transform.FindChild ("KuniName").gameObject;
			kuniNameObj.transform.FindChild ("Value").GetComponent<Text> ().text = kuniName;

			//Heiryoku
			status.transform.FindChild ("Heiryoku").transform.FindChild ("Value").GetComponent<Text> ().text = script.heiryoku.ToString ();

			//Yukou
			status.transform.FindChild ("Yukoudo").transform.FindChild ("Value").GetComponent<Text> ().text = script.myYukouValue.ToString ();

			//Attack Target
			bool aggressiveFlg = script.aggressiveFlg;
			int myDaimyoId = PlayerPrefs.GetInt ("myDaimyo");

			int targetKuniId = getKassenTargetKuni (kuniId, daimyoId, targetKuniList, kuniIconView, aggressiveFlg, seiryokuList, myDaimyoId);
			if (targetKuniId != 0) {
				string targetKuniName = kuni.getKuniName (targetKuniId);
				int targetDaimyoId = int.Parse (seiryokuList [targetKuniId - 1]);
				string targetDaimyoName = daimyo.getName (targetDaimyoId);
				status.transform.FindChild ("Atk").transform.FindChild ("Value").GetComponent<Text> ().text = targetKuniName + "(" + targetDaimyoName + ")";
			} else {
				status.transform.FindChild ("Atk").transform.FindChild ("Value").GetComponent<Text> ().text = "無し";
			}


			int targetGaikouKuniId = 0;
			if (snbRank > 1) { //Jyo or Cyu

				//Gaikou
				targetGaikouKuniId = getGaikouTargetKuni (kuniId, daimyoId, targetKuniList, kuniIconView, aggressiveFlg, seiryokuList, myDaimyoId);
				if (targetGaikouKuniId != 0) {
					string targetGaikouKuniName = kuni.getKuniName (targetGaikouKuniId);
					int targetGaikouDaimyoId = int.Parse (seiryokuList [targetGaikouKuniId - 1]);
					string targetGaikouDaimyoName = daimyo.getName (targetGaikouDaimyoId);
		
					status.transform.FindChild ("Gaiko").transform.FindChild ("Value").GetComponent<Text> ().text = targetGaikouKuniName + "(" + targetGaikouDaimyoName + ")";
				} else {
					status.transform.FindChild ("Gaiko").transform.FindChild ("Value").GetComponent<Text> ().text = "無し";
				}

				//Doumei
				string doumeiTmp = "doumei" + daimyoId.ToString ();
				string doumeiString = PlayerPrefs.GetString (doumeiTmp);
				List<string> doumeiList = new List<string> ();
				if (doumeiString != null && doumeiString != "") {
					if (doumeiString.Contains (",")) {
						doumeiList = new List<string> (doumeiString.Split (delimiterChars));
					} else {
						doumeiList.Add (doumeiString);
					}
				}

				string doumeiNameList = "無し";
				for (int j = 0; j < doumeiList.Count; j++) {
					if (j == 0) {
						doumeiNameList = daimyo.getName (int.Parse (doumeiList [j]));
					} else {
						doumeiNameList = doumeiNameList + "," + daimyo.getName (int.Parse (doumeiList [j]));
					}
				}

				status.transform.FindChild ("Doumei").transform.FindChild ("Value").GetComponent<Text> ().text = doumeiNameList;
			
			} else {
				//Ge
				status.transform.FindChild ("Gaiko").transform.FindChild ("Value").GetComponent<Text> ().text = "?";
				status.transform.FindChild ("Doumei").transform.FindChild ("Value").GetComponent<Text> ().text = "?";

			}


			if (snbRank > 2) { //Jyo
				BusyoInfoGet busyo = new BusyoInfoGet();

				string qtyAndHeisyu = busyo.getDaimyoBusyoQtyHeisyu(daimyoId);
				List<string> qtyAndHeisyuiList = new List<string> ();
				qtyAndHeisyuiList = new List<string> (qtyAndHeisyu.Split (delimiterChars));

				//BusyoQty
				//Heisyu
				status.transform.FindChild ("BusyoQty").transform.FindChild ("Value").GetComponent<Text> ().text = qtyAndHeisyuiList[0];
				status.transform.FindChild ("Heisyu").transform.FindChild ("Value").GetComponent<Text> ().text = qtyAndHeisyuiList[1];
			
			} else {
				//Cyu or Ge
				status.transform.FindChild ("BusyoQty").transform.FindChild ("Value").GetComponent<Text> ().text = "?";
				status.transform.FindChild ("Heisyu").transform.FindChild ("Value").GetComponent<Text> ().text = "?";

			}


			//Main Map
			foreach(Transform obj in board.transform){
				if (obj.name != "Explanation") {
					Destroy (obj.gameObject);
				}
			}

			string kuniMapPath = "Prefabs/Map/cyouhou/kuniImage";
			GameObject mainMap = Instantiate (Resources.Load (kuniMapPath)) as GameObject;
			mainMap.transform.SetParent(board.transform);
			mainMap.transform.localScale = new Vector2 (13, 9);
			mainMap.name = "kuniMap" + kuniId;
			string kuniImagePath = "Prefabs/Map/kuniMap/" + kuniId.ToString ();
			mainMap.GetComponent<Image> ().sprite = 
				Resources.Load (kuniImagePath, typeof(Sprite)) as Sprite;

			int baseX = kuni.getKuniLocationX (kuniId);
			int baseY = kuni.getKuniLocationY (kuniId);
			int adjstX = baseX * -1;
			int adjustY = baseY * -1;

			float colorR = daimyo.getColorR (daimyoId);
			float colorG = daimyo.getColorG (daimyoId);
			float colorB = daimyo.getColorB (daimyoId);
			Color kuniColor = new Color (colorR / 255f, colorG / 255f, colorB / 255f, 255f / 255f);
			mainMap.GetComponent<Image> ().color = kuniColor;

			RectTransform mapRect = mainMap.GetComponent<RectTransform> ();
			mapRect.anchoredPosition3D = new Vector3 (adjstX, adjustY, 0);

			//My Kuni Kamon Icon
			string kamonBackPath ="Prefabs/Map/cyouhou/KamonBack";
			GameObject kamonBack = Instantiate (Resources.Load (kamonBackPath)) as GameObject;
			kamonBack.transform.SetParent (board.transform);
			kamonBack.transform.localScale = new Vector2 (1, 1);
			kamonBack.transform.localPosition = new Vector2(0,0);

			string kamonKuniPath = "Prefabs/Map/Kuni/" + kuniId.ToString();
			GameObject kamonObj = Instantiate (Resources.Load (kamonKuniPath)) as GameObject;
			kamonObj.transform.SetParent (kamonBack.transform);
			kamonObj.transform.localScale = new Vector2 (1, 0.8f);
			kamonObj.transform.localPosition = new Vector2(0,0);
			kamonObj.GetComponent<Image> ().sprite = 
				Resources.Load (imagePath, typeof(Sprite)) as Sprite;
			kamonObj.GetComponent<Button> ().enabled = false;


			//Mapping Kuni
			Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst;
			for (int i=0; i < kuniMst.param.Count; i++) {
			//for (int i=0; i < targetKuniList.Count; i++) {
				int subKuniId = i + 1;

				GameObject subMap = Instantiate (Resources.Load (kuniMapPath)) as GameObject;
				subMap.transform.SetParent(mainMap.transform);
				subMap.transform.localScale = new Vector2 (1, 1);
				subMap.transform.localPosition = new Vector2 (0, 0);

				subMap.name = "kuniMap" + subKuniId;
				string subKuniImagePath = "Prefabs/Map/kuniMap/" + subKuniId;
				subMap.GetComponent<Image> ().sprite = 
					Resources.Load (subKuniImagePath, typeof(Sprite)) as Sprite;


				if (targetKuniList.Contains (subKuniId)) {
					//color
					int subDaimyoId = int.Parse (seiryokuList [subKuniId - 1]);
					float subColorR = daimyo.getColorR (subDaimyoId);
					float subColorG = daimyo.getColorG (subDaimyoId);
					float subColorB = daimyo.getColorB (subDaimyoId);
					Color subKuniColor = new Color (subColorR / 255f, subColorG / 255f, subColorB / 255f, 255f / 255f);
					subMap.GetComponent<Image> ().color = subKuniColor;

					//Kamon
					string subKamonKuniPath = "Prefabs/Map/Kuni/" + subKuniId.ToString ();
					GameObject subKamonObj = Instantiate (Resources.Load (subKamonKuniPath)) as GameObject;
					subKamonObj.transform.SetParent (board.transform);
					subKamonObj.transform.localScale = new Vector2 (1, 0.8f);
					if (daimyoId != subDaimyoId) {
						string subImagePath = "Prefabs/Kamon/" + subDaimyoId.ToString ();
						subKamonObj.GetComponent<Image> ().sprite = 
							Resources.Load (subImagePath, typeof(Sprite)) as Sprite;

						//yukoudo
						int yukoudoValue = gaikou.getExistGaikouValue (daimyoId, subDaimyoId);
						string syukoudoPath = "Prefabs/Map/cyouhou/YukoudoLabel";
						GameObject yukoudoObj = Instantiate (Resources.Load (syukoudoPath)) as GameObject;
						yukoudoObj.transform.SetParent (subKamonObj.transform);
						yukoudoObj.GetComponent<Text> ().text = yukoudoValue.ToString ();
						yukoudoObj.transform.localScale = new Vector2 (0.08f, 0.1f);
						yukoudoObj.transform.localPosition = new Vector2 (0, 26);

					} else {
						subKamonObj.GetComponent<Image> ().sprite = 
							Resources.Load (imagePath, typeof(Sprite)) as Sprite;
					}
					subKamonObj.GetComponent<Button> ().enabled = false;

					//Kamon adjustment
					int subBaseX = kuni.getKuniLocationX (subKuniId);
					int subBaseY = kuni.getKuniLocationY (subKuniId);
					int subAdjstX = subBaseX - baseX;
					int subAdjstY = subBaseY - baseY;

					RectTransform subMapRect = subKamonObj.GetComponent<RectTransform> ();
					subMapRect.anchoredPosition3D = new Vector3 (subAdjstX, subAdjstY, 0);

					if (targetKuniId != 0) {
						if (targetKuniId == subKuniId) {
							//kassen target
							Color atkColor = new Color (180f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
							subKamonObj.GetComponent<Image> ().color = atkColor;
						}
					}

					if (snbRank > 1) {
						if (targetGaikouKuniId != 0) {
							if (targetGaikouKuniId == subKuniId) {
								//kassen target
								Color gaikouColor = new Color (80f / 255f, 100f / 255f, 185f / 255f, 255f / 255f);
								subKamonObj.GetComponent<Image> ().color = gaikouColor;
							}
						}
					}
				} else {
					Color noSubKuniColor = new Color (255f / 255f, 255f / 255f, 255f / 255f, 40f / 255f);
					subMap.GetComponent<Image> ().color = noSubKuniColor;
				}

			}






		}


	}
Esempio n. 12
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        audioSources [2].Play();

        /*Busyo View*/
        //Delete Previous
        foreach (Transform n in GameObject.Find("BusyoView").transform)
        {
            GameObject.Destroy(n.gameObject);
        }
        //Jinkei Flg
        if (jinkeiFlg)
        {
            string     iconPath = "Prefabs/Busyo/Jinkei";
            GameObject jinkei   = Instantiate(Resources.Load(iconPath)) as GameObject;
            jinkei.transform.SetParent(GameObject.Find("BusyoView").transform);
            jinkei.transform.localScale    = new Vector2(0.3f, 0.3f);
            jinkei.transform.localPosition = new Vector2(220, 200);
            jinkei.name = "jinkei";
        }

        //Make New Busyo
        string busyoId;

        busyoId = this.name.Remove(0, 4);
        string     path  = "Prefabs/Player/Unit/BusyoUnit";
        GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject;

        Busyo.name = busyoId.ToString();
        Busyo.transform.SetParent(GameObject.Find("BusyoView").transform);
        Busyo.transform.localScale = new Vector2(4, 4);
        Busyo.GetComponent <DragHandler> ().enabled = false;

        RectTransform rect_transform = Busyo.GetComponent <RectTransform>();

        rect_transform.anchoredPosition3D = new Vector3(300, 200, 0);
        rect_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, int.Parse(busyoId));

        ShipObj.transform.localPosition = new Vector3(-40, -40, 0);
        ShipObj.transform.localScale    = new Vector2(0.4f, 0.4f);
        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
        GameObject text = Busyo.transform.FindChild("Text").gameObject;

        text.GetComponent <Text> ().color = new Color(255, 255, 255, 255);
        RectTransform text_transform = text.GetComponent <RectTransform>();

        text_transform.anchoredPosition3D = new Vector3(-70, 30, 0);
        text_transform.sizeDelta          = new Vector2(630, 120);
        text.transform.localScale         = new Vector2(0.2f, 0.2f);

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

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


        /*Busyo Status*/
        NowOnBusyo   NowOnBusyoScript   = GameObject.Find("GameScene").GetComponent <NowOnBusyo> ();
        BusyoInfoGet busyoInfoGetScript = new BusyoInfoGet();

        if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Ronkou")
        {
            int       lv  = PlayerPrefs.GetInt(busyoId);
            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;

            //add lv
            string addLvTmp = "addlv" + busyoId.ToString();
            if (PlayerPrefs.HasKey(addLvTmp))
            {
                string addLvValue = "+" + PlayerPrefs.GetString(addLvTmp);
                GameObject.Find("addLvValue").GetComponent <Text>().text = addLvValue.ToString();
            }
            else
            {
                GameObject.Find("addLvValue").GetComponent <Text>().text = "";
            }
            int maxLv = 100 + PlayerPrefs.GetInt(addLvTmp);

            GameObject.Find("LvValue").GetComponent <Text> ().text       = lv.ToString();
            GameObject.Find("TosotsuValue").GetComponent <Text> ().text  = adjHp.ToString();
            GameObject.Find("BuyuuValue").GetComponent <Text> ().text    = adjAtk.ToString();
            GameObject.Find("ChiryakuValue").GetComponent <Text> ().text = adjDfc.ToString();
            GameObject.Find("SpeedValue").GetComponent <Text> ().text    = spd.ToString();

            //Exp
            string expId       = "exp" + busyoId.ToString();
            string expString   = "";
            int    nowExp      = PlayerPrefs.GetInt(expId);
            Exp    exp         = new Exp();
            int    requiredExp = 0;
            if (lv != maxLv)
            {
                requiredExp = exp.getExpforNextLv(lv);
            }
            else
            {
                requiredExp = exp.getExpLvMax(maxLv);
            }


            expString = nowExp + "/" + requiredExp;
            GameObject.Find("ExpValue").GetComponent <Text> ().text = expString;

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


            //Kanni
            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();
                    string kanniIkai = kanni.getIkai(kanniId);
                    string kanniName = kanni.getKanni(kanniId);
                    GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text> ().text = kanniIkai + "\n" + kanniName;

                    //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;
                    }
                }
                else
                {
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "No Rank";
                    }
                    else
                    {
                        GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し";
                    }
                }
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text> ().text = "No Rank";
                }
                else
                {
                    GameObject.Find("StatusKanni").transform.FindChild("Value").GetComponent <Text>().text = "官位無し";
                }
            }

            //Jyosyu
            string jyosyuTmp = "jyosyuBusyo" + busyoId;
            if (PlayerPrefs.HasKey(jyosyuTmp))
            {
                int      kuniId   = PlayerPrefs.GetInt(jyosyuTmp);
                KuniInfo kuni     = new KuniInfo();
                string   kuniName = kuni.getKuniName(kuniId);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text> ().text = kuniName + "\nLord";
                }
                else
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = kuniName + "\n城主";
                }
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "No Feud";
                }
                else
                {
                    GameObject.Find("StatusJyosyu").transform.FindChild("Value").GetComponent <Text>().text = "城無し";
                }
            }

            //Show Additional Status
            int finalAtk = int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni);
            int finalHp  = int.Parse(KahouStatusArray [1]) + Mathf.FloorToInt(addHpByKanni);
            int finalDfc = int.Parse(KahouStatusArray [2]) + Mathf.FloorToInt(addDfcByKanni);
            int finalSpd = int.Parse(KahouStatusArray [3]);

            GameObject.Find("KahouAtkValue").GetComponent <Text> ().text = "+" + finalAtk.ToString();
            GameObject.Find("KahouHpValue").GetComponent <Text>().text   = "+" + finalHp.ToString();
            totalBusyoHp = adjHp + finalHp;
            GameObject.Find("KahouDfcValue").GetComponent <Text>().text = "+" + finalDfc.ToString();
            GameObject.Find("KahouSpdValue").GetComponent <Text>().text = "+" + finalSpd.ToString();

            //Butai Status
            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();
            }


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

                string ch_type   = ch_list [0];
                int    ch_num    = int.Parse(ch_list [1]);
                int    ch_lv     = int.Parse(ch_list [2]);
                float  ch_status = float.Parse(ch_list [3]);

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

                GameObject.Find("ChildNameValue").GetComponent <Text> ().text = heisyu;
                GameObject.Find("ChildQtyValue").GetComponent <Text> ().text  = ch_num.ToString();
                GameObject.Find("ChildLvValue").GetComponent <Text> ().text   = ch_lv.ToString();

                //Jyosyu Handling
                JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku();
                float          addHei    = (float)jyosyuHei.GetJyosyuHeiryoku(busyoId);
                float          hei       = ch_status * 10;
                GameObject.Find("ChildHeiryokuValue").GetComponent <Text>().text = hei.ToString();
                float newHei = finalHp + addHei;
                GameObject.Find("KahouHpValue").GetComponent <Text>().text = "+" + newHei.ToString();

                int    chAtkDfc       = (int)sts.getChAtkDfc((int)hei, totalBusyoHp);
                string chAtkDfcString = chAtkDfc.ToString() + "/" + chAtkDfc.ToString();
                GameObject.Find("ChildStatusValue").GetComponent <Text> ().text = chAtkDfcString;


                //Child Image
                foreach (Transform n in GameObject.Find("Img").transform)
                {
                    GameObject.Destroy(n.gameObject);
                }
                string     chPath = "Prefabs/Player/Unit/" + ch_type;
                GameObject chObj  = Instantiate(Resources.Load(chPath)) as GameObject;
                chObj.transform.SetParent(GameObject.Find("Img").transform);
                RectTransform chTransform = chObj.GetComponent <RectTransform> ();
                chTransform.anchoredPosition3D = new Vector3(-200, -50, 0);
                chTransform.sizeDelta          = new Vector2(40, 40);
                chObj.transform.localScale     = new Vector2(4, 4);


                GameObject chigyo = GameObject.Find("ButtonCyouhei");
                if (ch_num < 20)
                {
                    chigyo.GetComponent <Image> ().color = OKClorBtn;
                    chigyo.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
                    chigyo.GetComponent <Button>().enabled = true;

                    chigyo.GetComponent <BusyoStatusButton> ().ch_type   = ch_type;
                    chigyo.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu;
                    chigyo.GetComponent <BusyoStatusButton> ().ch_num    = ch_num;
                    chigyo.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc;
                    chigyo.GetComponent <BusyoStatusButton> ().ch_hp     = hei;
                    chigyo.GetComponent <BusyoStatusButton> ().pa_hp     = totalBusyoHp / 100;
                }
                else
                {
                    //MAX
                    chigyo.GetComponent <Image> ().color = NGClorBtn;
                    chigyo.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
                    chigyo.GetComponent <Button>().enabled = false;
                }
                GameObject kunren = GameObject.Find("ButtonKunren");
                if (ch_lv < 100)
                {
                    kunren.GetComponent <Image> ().color = OKClorBtn;
                    kunren.transform.FindChild("Text").GetComponent <Text> ().color = OKClorTxt;
                    kunren.GetComponent <Button>().enabled = true;

                    kunren.GetComponent <BusyoStatusButton> ().ch_type   = ch_type;
                    kunren.GetComponent <BusyoStatusButton> ().ch_heisyu = heisyu;
                    kunren.GetComponent <BusyoStatusButton> ().ch_lv     = ch_lv;
                    kunren.GetComponent <BusyoStatusButton> ().ch_num    = ch_num;
                    kunren.GetComponent <BusyoStatusButton> ().ch_status = chAtkDfc;
                    kunren.GetComponent <BusyoStatusButton> ().ch_hp     = hei;
                    kunren.GetComponent <BusyoStatusButton> ().pa_hp     = totalBusyoHp / 100;
                }
                else
                {
                    //MAX
                    kunren.GetComponent <Image> ().color = NGClorBtn;
                    kunren.transform.FindChild("Text").GetComponent <Text> ().color = NGClorTxt;
                    kunren.GetComponent <Button>().enabled = false;
                }
            }

            //Parametor Setting
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Senpou")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            SenpouScene scene = new SenpouScene();
            scene.createSenpouStatusView(busyoId);
            scene.createSakuStatusView(busyoId);
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Kahou")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            KahouScene kahou = new KahouScene();
            kahou.createKahouStatusView(busyoId);
        }
        else if (GameObject.Find("GameScene").GetComponent <NowOnButton> ().onButton == "Syogu")
        {
            NowOnBusyoScript.OnBusyo     = busyoId;
            NowOnBusyoScript.OnBusyoName = busyoInfoGetScript.getName(int.Parse(busyoId));
            SyoguScene syogu = new SyoguScene();
            syogu.createSyoguView(busyoId);
        }
    }
Esempio n. 13
0
    /*make engun instance*/
    public void makeEngunInstance(int busyoId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int ch_num, int ch_lv)
    {
        /*Parent Instantiate*/
        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      onlySeaFlg   = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]);

        if (!onlySeaFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];

            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }

        //Engun Flg
        prefab.GetComponent <Kunkou> ().engunFlg = true;



        /*Player Status Setting*/
        //parametor setting
        int adjHp  = hp * 100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;

        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1.3f, -1);
        dtl.transform.localScale    = new Vector3(1.3f, 1.3f, 0);
        dtl.name = "BusyoDtlPlayer";
        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh> ().text = busyoName;

        //HP Bar
        GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = adjHp;

        //Location by map id
        prefab.transform.position = new Vector2(-20, -16);
        prefab.GetComponent <LineLocation>().nowLine = 5;

        //heisyu
        BusyoInfoGet info    = new BusyoInfoGet();
        string       ch_type = info.getHeisyu(busyoId);

        prefab.GetComponent <PlayerHP> ().life = adjHp;

        //adjust spd
        float adjSpd = (float)spd / 10;


        if (prefab.GetComponent <PlayerAttack> ())
        {
            prefab.GetComponent <PlayerAttack> ().attack = adjAtk;
            prefab.GetComponent <UnitMover> ().speed     = adjSpd;
        }
        else
        {
            if (ch_type == "TP")
            {
                prefab.GetComponent <AttackLong> ().attack = 5 * adjAtk;
            }
            else if (ch_type == "YM")
            {
                prefab.GetComponent <AttackLong> ().attack = 3 * adjAtk;
            }
            prefab.GetComponent <UnitMover> ().speed = adjSpd;
        }
        prefab.GetComponent <PlayerHP>().dfc     = adjDfc;
        prefab.GetComponent <UnitMover>().heisyu = ch_type;

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, ch_type);



        /*Child Instantiate*/
        //set child object
        Entity_lvch_mst lvMst     = Resources.Load("Data/lvch_mst") as Entity_lvch_mst;
        int             startline = 0;

        if (ch_type == "KB")
        {
            startline = 0;
        }
        else if (ch_type == "YR")
        {
            startline = 1;
        }
        else if (ch_type == "TP")
        {
            startline = 2;
        }
        else if (ch_type == "YM")
        {
            startline = 3;
        }
        object    stslst = lvMst.param[startline];
        Type      t      = stslst.GetType();
        String    param  = "lv" + ch_lv.ToString();
        FieldInfo f      = t.GetField(param);
        int       sts    = (int)f.GetValue(stslst);

        float ch_status = (float)sts;

        ch_status = ch_status * 10;

        string ch_path = "Prefabs/Player/" + ch_type;

        float y1 = 3.0f;
        float y2 = 3.0f;
        float y3 = 3.0f;
        float y4 = 3.0f;

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.parent = prefab.transform;
            ch_prefab.name             = "Child" + i.ToString();

            //Sashimono Making
            string     sashimono_path = "Prefabs/Sashimono/" + busyoId;
            GameObject sashimono      = Instantiate(Resources.Load(sashimono_path)) as GameObject;
            sashimono.transform.parent     = ch_prefab.transform;
            sashimono.transform.localScale = new Vector2(0.3f, 0.3f);


            if (ch_type == "YR")
            {
                sashimono.transform.localPosition = new Vector2(-1, 0.6f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 3, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 6, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 9, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 12, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "KB")
            {
                sashimono.transform.localPosition = new Vector2(-0.5f, 1);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "TP")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "YM")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }

            //Status
            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <PlayerHP>().childQty = ch_num;

                //Child Unit HP
                prefab.GetComponent <PlayerHP>().childHP = (int)ch_status;

                StatusGet stsScript = new StatusGet();
                int       atkDfc    = (int)stsScript.getChAtkDfc((int)ch_status, adjHp);

                //Attack
                if (ch_type == "YM")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 3;
                }
                else if (ch_type == "TP")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 5;
                }
                else
                {
                    prefab.GetComponent <PlayerAttack> ().attack = prefab.GetComponent <PlayerAttack> ().attack + (ch_num * atkDfc);
                }

                //Dfc
                prefab.GetComponent <PlayerHP> ().dfc = prefab.GetComponent <PlayerHP> ().dfc + (ch_num * atkDfc);
            }
        }
    }
Esempio n. 14
0
    public void makeInstance(int busyoId, int mapId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int soudaisyo, int boubi)
    {
        /*Parent Instantiate*/
        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();

        //Senpou Script Parametor
        StatusGet senpouScript = new StatusGet();
        bool      onlySeaFlg   = senpouScript.getSenpouOnlySeaFlg((int)senpouArray[0]);

        if (!onlySeaFlg)
        {
            prefab.GetComponent <SenpouController>().senpouId     = (int)senpouArray[0];
            prefab.GetComponent <SenpouController>().senpouTyp    = senpouArray[1].ToString();
            prefab.GetComponent <SenpouController>().senpouName   = senpouArray[2].ToString();
            prefab.GetComponent <SenpouController>().senpouEach   = (float)senpouArray[4];
            prefab.GetComponent <SenpouController>().senpouRatio  = (float)senpouArray[5];
            prefab.GetComponent <SenpouController>().senpouTerm   = (float)senpouArray[6];
            prefab.GetComponent <SenpouController>().senpouStatus = (int)senpouArray[7];
            prefab.GetComponent <SenpouController>().senpouLv     = (int)senpouArray[8];

            //Serihu
            Entity_serihu_mst serihuMst = Resources.Load("Data/serihu_mst") as Entity_serihu_mst;
            string            serihu    = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsgEng;
            }
            else
            {
                serihu = serihuMst.param[busyoId - 1].senpouMsg;
            }
            prefab.GetComponent <SenpouController>().senpouSerihu = serihu;
        }
        else
        {
            Destroy(prefab.GetComponent <SenpouController>());
        }



        /*Player Status Setting*/
        //parametor setting
        int adjHp  = hp * 100;
        int adjAtk = atk * 10;
        int adjDfc = dfc * 10;

        //heisyu
        BusyoInfoGet info   = new BusyoInfoGet();
        string       heisyu = info.getHeisyu(busyoId);

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

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

        string[] KahouStatusArray = kahouSts.getKahouForStatus(busyoId.ToString(), adjHp, adjAtk, adjDfc, spd);

        //Kanni Adjustment
        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;
                }
            }
        }


        //Busyo Detail Info [Name & HP Bar]
        string dtlPath = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayerEng";
        }
        else
        {
            dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
        }
        GameObject dtl = Instantiate(Resources.Load(dtlPath)) as GameObject;

        dtl.transform.SetParent(prefab.transform);
        dtl.transform.localPosition = new Vector3(0, 1.3f, -1);
        dtl.transform.localScale    = new Vector3(1.3f, 1.3f, 0);
        dtl.name = "BusyoDtlPlayer";

        //Name
        GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;

        nameLabel.GetComponent <TextMesh> ().text = busyoName;


        //Location by map id
        if (mapId == 1)
        {
            prefab.transform.position = new Vector2(-65, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 2)
        {
            prefab.transform.position = new Vector2(-50, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 3)
        {
            prefab.transform.position = new Vector2(-35, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 4)
        {
            prefab.transform.position = new Vector2(-20, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 5)
        {
            prefab.transform.position = new Vector2(-5, 16);
            prefab.GetComponent <LineLocation>().nowLine = 1;
        }
        else if (mapId == 6)
        {
            prefab.transform.position = new Vector2(-65, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 7)
        {
            prefab.transform.position = new Vector2(-50, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 8)
        {
            prefab.transform.position = new Vector2(-35, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 9)
        {
            prefab.transform.position = new Vector2(-20, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 10)
        {
            prefab.transform.position = new Vector2(-5, 8);
            prefab.GetComponent <LineLocation>().nowLine = 2;
        }
        else if (mapId == 11)
        {
            prefab.transform.position = new Vector2(-65, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 12)
        {
            prefab.transform.position = new Vector2(-50, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 13)
        {
            prefab.transform.position = new Vector2(-35, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 14)
        {
            prefab.transform.position = new Vector2(-20, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 15)
        {
            prefab.transform.position = new Vector2(-5, 0);
            prefab.GetComponent <LineLocation>().nowLine = 3;
        }
        else if (mapId == 16)
        {
            prefab.transform.position = new Vector2(-65, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 17)
        {
            prefab.transform.position = new Vector2(-50, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 18)
        {
            prefab.transform.position = new Vector2(-35, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 19)
        {
            prefab.transform.position = new Vector2(-20, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 20)
        {
            prefab.transform.position = new Vector2(-5, -8);
            prefab.GetComponent <LineLocation>().nowLine = 4;
        }
        else if (mapId == 21)
        {
            prefab.transform.position = new Vector2(-65, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 22)
        {
            prefab.transform.position = new Vector2(-50, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 23)
        {
            prefab.transform.position = new Vector2(-45, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 24)
        {
            prefab.transform.position = new Vector2(-20, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }
        else if (mapId == 25)
        {
            prefab.transform.position = new Vector2(-5, -16);
            prefab.GetComponent <LineLocation>().nowLine = 5;
        }

        //Add Senryoku
        string key = "addSenryokuSlot" + mapId;

        if (PlayerPrefs.HasKey(key))
        {
            string        atkDfc          = PlayerPrefs.GetString(key);
            List <string> atkDfcList      = new List <string> ();
            char[]        delimiterChars2 = { ',' };
            atkDfcList = new List <string> (atkDfc.Split(delimiterChars2));
            adjAtk     = adjAtk + int.Parse(atkDfcList [0]);
            adjDfc     = adjDfc + int.Parse(atkDfcList [1]);
        }


        //HP Status
        int        adjHpWithKahou = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt(addHpByKanni);
        GameObject minHpBar       = dtl.transform.FindChild("MinHpBar").gameObject;

        minHpBar.GetComponent <BusyoHPBar>().initLife = adjHpWithKahou;
        prefab.GetComponent <PlayerHP> ().life        = adjHpWithKahou + addJyosyuHei;


        //spd adjust
        float adjSpd = ((float)spd + float.Parse(KahouStatusArray[3])) / 10;

        prefab.GetComponent <UnitMover> ().heisyu = heisyu;
        if (prefab.GetComponent <PlayerAttack> ())
        {
            prefab.GetComponent <PlayerAttack> ().attack = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt(addAtkByKanni);
            prefab.GetComponent <UnitMover>().speed      = adjSpd;
        }
        else
        {
            if (heisyu == "TP")
            {
                prefab.GetComponent <AttackLong> ().attack = 5 * (adjAtk + int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni));
            }
            else if (heisyu == "YM")
            {
                prefab.GetComponent <AttackLong> ().attack = 3 * (adjAtk + int.Parse(KahouStatusArray [0]) + Mathf.FloorToInt(addAtkByKanni));
            }
            prefab.GetComponent <UnitMover> ().speed = adjSpd;
        }

        prefab.GetComponent <PlayerHP>().dfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt(addDfcByKanni) + boubi;



        //Soudaisyo
        if (busyoId == soudaisyo)
        {
            prefab.GetComponent <PlayerHP> ().taisyo = true;
        }

        //SE
        AudioController audio = new AudioController();

        audio.addComponentMoveAttack(prefab, heisyu);


        /*Child Instantiate*/
        //set child object
        string heiId           = "hei" + busyoId.ToString();
        string chParam         = "";
        bool   tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");

        if (!tutorialDoneFlg || Application.loadedLevelName != "tutorialKassen")
        {
            chParam = PlayerPrefs.GetString(heiId, "0");
        }
        else
        {
            //retry tutorial
            if (busyoId == 19)
            {
                chParam = "TP:2:1:1";
            }
            else
            {
                StatusGet statusScript  = new StatusGet();
                string    chParamHeisyu = statusScript.getHeisyu(busyoId);
                chParam = chParamHeisyu + ":1:1:1";
            }
        }

        if (chParam == "0")
        {
            StatusGet statusScript  = new StatusGet();
            string    chParamHeisyu = statusScript.getHeisyu(busyoId);
            chParam = chParamHeisyu + ":1:1:1";
            PlayerPrefs.SetString(heiId, chParam);
            PlayerPrefs.Flush();
        }


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

        string ch_type   = ch_list[0];
        int    ch_num    = int.Parse(ch_list[1]);
        int    ch_lv     = int.Parse(ch_list[2]);
        float  ch_status = float.Parse(ch_list[3]);

        ch_status = ch_status * 10;

        string ch_path = "Prefabs/Player/" + ch_type;

        float y1 = 3.0f;
        float y2 = 3.0f;
        float y3 = 3.0f;
        float y4 = 3.0f;

        for (int i = 1; i <= ch_num; i++)
        {
            //Make Relationship
            GameObject ch_prefab = Instantiate(Resources.Load(ch_path)) as GameObject;
            ch_prefab.transform.parent = prefab.transform;
            ch_prefab.name             = "Child" + i.ToString();

            //Sashimono Making
            string     sashimono_path = "Prefabs/Sashimono/" + busyoId;
            GameObject sashimono      = Instantiate(Resources.Load(sashimono_path)) as GameObject;
            sashimono.transform.parent     = ch_prefab.transform;
            sashimono.transform.localScale = new Vector2(0.3f, 0.3f);


            if (ch_type == "YR")
            {
                sashimono.transform.localPosition = new Vector2(-1, 0.6f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 3, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 6, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 9, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 12, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "KB")
            {
                sashimono.transform.localPosition = new Vector2(-0.5f, 1);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "TP")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }
            else if (ch_type == "YM")
            {
                sashimono.transform.localPosition = new Vector2(-0.8f, 0.5f);
                //Location
                if (i < 6)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 4, prefab.transform.position.y + y1);
                    y1 = y1 - 1.5f;
                }
                else if (5 < i && i < 11)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 7, prefab.transform.position.y + y2);
                    y2 = y2 - 1.5f;
                }
                else if (10 < i && i < 16)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 10, prefab.transform.position.y + y3);
                    y3 = y3 - 1.5f;
                }
                else if (15 < i && i < 21)
                {
                    ch_prefab.transform.position = new Vector2(prefab.transform.position.x - 13, prefab.transform.position.y + y4);
                    y4 = y4 - 1.5f;
                }
            }



            StatusGet sts    = new StatusGet();
            int       atkDfc = (int)sts.getChAtkDfc((int)ch_status, adjHpWithKahou);

            if (i == 1)
            {
                //Child Qty
                prefab.GetComponent <PlayerHP>().childQty = ch_num;

                //Child Unit HP
                float addTotalHei = ch_status;
                prefab.GetComponent <PlayerHP>().childHP = (int)addTotalHei;

                //Attack
                if (ch_type == "YM")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 3;
                    prefab.GetComponent <Heisyu> ().atk             = atkDfc * 3;
                }
                else if (ch_type == "TP")
                {
                    prefab.GetComponent <AttackLong> ().childAttack = atkDfc * 5;
                    prefab.GetComponent <Heisyu> ().atk             = atkDfc * 5;
                }
                else
                {
                    prefab.GetComponent <PlayerAttack> ().attack = prefab.GetComponent <PlayerAttack> ().attack + (ch_num * atkDfc);
                    prefab.GetComponent <Heisyu> ().atk          = atkDfc;
                }

                //Dfc
                prefab.GetComponent <PlayerHP> ().dfc = prefab.GetComponent <PlayerHP> ().dfc + (ch_num * atkDfc);
                prefab.GetComponent <Heisyu> ().dfc   = atkDfc;
            }
        }
    }
Esempio n. 15
0
    void Start()
    {
        GameScene gameSceneScript = new GameScene();

        //Sound
        BGMSESwitch bgm = new BGMSESwitch();

        bgm.StopSEVolume();
        bgm.StopKassenBGMVolume();

        //Taiko
        StartCoroutine("taikoMusic");

        //Kill Prevous BGM
        KillOtherBGM kill = new KillOtherBGM();

        kill.Start();

        //Giveup button
        bool isAttackedFlg = PlayerPrefs.GetBool("isAttackedFlg");

        if (isAttackedFlg)
        {
            GameObject.Find("GiveupBtn").SetActive(false);
        }

        //Auto button
        bool Auto2Flg = PlayerPrefs.GetBool("Auto2Flg");

        if (Auto2Flg)
        {
            GameObject.Find("AutoBtn").transform.FindChild("Num").GetComponent <Text>().text = "2";
            GameObject.Find("AutoBtn").GetComponent <AutoAttack>().speed = 2;
        }

        //Dinamic Map
        activeKuniId  = PlayerPrefs.GetInt("activeKuniId");
        activeStageId = PlayerPrefs.GetInt("activeStageId");
        GameObject wall = Instantiate(wallPrefab);

        wall.name = "wall";
        kaisenWeatherHandling(map);

        //Get Minus Status
        float rainMinusRatio = PlayerPrefs.GetFloat("rainMinusStatus", 0);
        float snowMinusRatio = PlayerPrefs.GetFloat("snowMinusStatus", 0);

        /*Player Setting*/
        int        jinkei      = PlayerPrefs.GetInt("jinkei", 0);
        List <int> myBusyoList = new List <int>();

        if (jinkei == 1)
        {
            soudaisyo = PlayerPrefs.GetInt("soudaisyo1");
            if (PlayerPrefs.HasKey("1map1"))
            {
                int mapId = 1;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map2"))
            {
                int mapId = 2;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map7"))
            {
                int mapId = 7;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map8"))
            {
                int mapId = 8;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map11"))
            {
                int mapId = 11;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map12"))
            {
                int mapId = 12;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map13"))
            {
                int mapId = 13;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map14"))
            {
                int mapId = 14;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map17"))
            {
                int mapId = 17;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map18"))
            {
                int mapId = 18;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map21"))
            {
                int mapId = 21;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("1map22"))
            {
                int mapId = 22;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
        }
        else if (jinkei == 2)
        {
            soudaisyo = PlayerPrefs.GetInt("soudaisyo2");

            if (PlayerPrefs.HasKey("2map3"))
            {
                int mapId = 3;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map4"))
            {
                int mapId = 4;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map5"))
            {
                int mapId = 5;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map7"))
            {
                int mapId = 7;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map8"))
            {
                int mapId = 8;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map11"))
            {
                int mapId = 11;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map12"))
            {
                int mapId = 12;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map17"))
            {
                int mapId = 17;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map18"))
            {
                int mapId = 18;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map23"))
            {
                int mapId = 23;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map24"))
            {
                int mapId = 24;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("2map25"))
            {
                int mapId = 25;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
        }
        else if (jinkei == 3)
        {
            soudaisyo = PlayerPrefs.GetInt("soudaisyo3");

            if (PlayerPrefs.HasKey("3map3"))
            {
                int mapId = 3;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map7"))
            {
                int mapId = 7;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map8"))
            {
                int mapId = 8;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map9"))
            {
                int mapId = 9;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map11"))
            {
                int mapId = 11;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map12"))
            {
                int mapId = 12;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map14"))
            {
                int mapId = 14;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map15"))
            {
                int mapId = 15;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map16"))
            {
                int mapId = 16;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map20"))
            {
                int mapId = 20;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map21"))
            {
                int mapId = 21;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("3map25"))
            {
                int mapId = 25;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
        }
        else if (jinkei == 4)
        {
            soudaisyo = PlayerPrefs.GetInt("soudaisyo4");

            if (PlayerPrefs.HasKey("4map1"))
            {
                int mapId = 1;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map2"))
            {
                int mapId = 2;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map7"))
            {
                int mapId = 7;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map8"))
            {
                int mapId = 8;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map12"))
            {
                int mapId = 12;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map13"))
            {
                int mapId = 13;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map14"))
            {
                int mapId = 14;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map18"))
            {
                int mapId = 18;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map19"))
            {
                int mapId = 19;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map20"))
            {
                int mapId = 20;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map24"))
            {
                int mapId = 24;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
            if (PlayerPrefs.HasKey("4map25"))
            {
                int mapId = 25;
                myBusyoList.Add(getStsAndMakeInstance(jinkei, mapId, rainMinusRatio, snowMinusRatio));
            }
        }

        //Saku
        BusyoInfoGet info     = new BusyoInfoGet();
        StatusGet    sts      = new StatusGet();
        GameObject   content  = GameObject.Find("Content").gameObject;
        string       slotPath = "Prefabs/Saku/Slot";
        Saku         saku     = new Saku();

        foreach (Transform n in content.transform)
        {
            GameObject.Destroy(n.gameObject);
        }

        foreach (int busyoId in myBusyoList)
        {
            List <string> sakuList = new List <string>();
            sakuList = saku.getSakuInfo(busyoId);

            if (saku.getSakuShipFlg(int.Parse(sakuList[0])))
            {
                GameObject slot     = Instantiate(Resources.Load(slotPath)) as GameObject;
                string     sakuPath = "Prefabs/Saku/saku" + sakuList[0];
                GameObject sakuIcon = Instantiate(Resources.Load(sakuPath)) as GameObject;
                sakuIcon.transform.SetParent(slot.transform);
                sakuIcon.transform.localScale            = new Vector2(0.45f, 0.45f);
                sakuIcon.GetComponent <Button>().enabled = false;

                slot.transform.SetParent(content.transform);
                slot.transform.localScale = new Vector2(1, 1);

                slot.GetComponent <Saku>().sakuId     = int.Parse(sakuList[0]);
                slot.GetComponent <Saku>().sakuEffect = int.Parse(sakuList[4]);

                if (sakuList[0] == "3")
                {
                    //hukuhei
                    //Heisyu
                    slot.GetComponent <Saku>().sakuHeisyu = info.getHeisyu(busyoId);
                    //Hei Status
                    string heiId   = "hei" + busyoId.ToString();
                    string chParam = PlayerPrefs.GetString(heiId, "0");
                    if (chParam == "0" || chParam == "")
                    {
                        StatusGet statusScript  = new StatusGet();
                        string    chParamHeisyu = statusScript.getHeisyu(busyoId);
                        chParam = chParamHeisyu + ":1:1:1";
                        PlayerPrefs.SetString(heiId, chParam);
                        PlayerPrefs.Flush();
                    }

                    char[]   delimiterChars = { ':' };
                    string[] ch_list        = chParam.Split(delimiterChars);
                    slot.GetComponent <Saku>().sakuHeiSts  = float.Parse(ch_list[3]);
                    slot.GetComponent <Saku>().sakuBusyoId = busyoId;

                    //Busyo Speed
                    int   sakuBusyoLv = PlayerPrefs.GetInt(busyoId.ToString());
                    float adjSpd      = (float)sts.getSpd(busyoId, sakuBusyoLv) / 10;
                    slot.GetComponent <Saku>().sakuBusyoSpeed = adjSpd;
                }
            }
        }

        //Nanban
        string        nanbanString = PlayerPrefs.GetString("nanbanItem");
        List <string> nanbanList   = new List <string>();

        char[] delimiterChars3 = { ',' };
        nanbanList = new List <string>(nanbanString.Split(delimiterChars3));

        for (int i = 0; i < nanbanList.Count; i++)
        {
            int qty = int.Parse(nanbanList[i]);
            if (qty != 0)
            {
                if (i == 0 || i == 1)
                {
                    GameObject slot = Instantiate(Resources.Load(slotPath)) as GameObject;

                    string nanbanPath = "";
                    if (i == 0)
                    {
                        nanbanPath = "Prefabs/Saku/saku8";
                    }
                    else if (i == 1)
                    {
                        nanbanPath = "Prefabs/Saku/saku9";
                    }

                    GameObject sakuIcon = Instantiate(Resources.Load(nanbanPath)) as GameObject;
                    sakuIcon.transform.SetParent(slot.transform);
                    sakuIcon.transform.localScale            = new Vector2(0.45f, 0.45f);
                    sakuIcon.GetComponent <Button>().enabled = false;

                    slot.transform.SetParent(content.transform);
                    slot.transform.localScale = new Vector2(1, 1);

                    if (i == 0)
                    {
                        slot.GetComponent <Saku>().sakuId = 8;
                    }
                    else if (i == 1)
                    {
                        slot.GetComponent <Saku>().sakuId = 9;
                    }
                    else if (i == 2)
                    {
                        slot.GetComponent <Saku>().sakuId = 10;
                    }

                    int      temp   = i + 1;
                    ItemInfo item   = new ItemInfo();
                    string   itemCd = "nanban" + temp.ToString();
                    int      effect = item.getItemEffect(itemCd);
                    slot.GetComponent <Saku>().sakuEffect = effect;
                }
            }
        }


        /*エネミー配置*/
        int linkNo = PlayerPrefs.GetInt("activeLink", 0);

        enemySoudaisyo = PlayerPrefs.GetInt("enemySoudaisyo");

        if (PlayerPrefs.HasKey("emap1"))
        {
            int mapId = 1;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap2"))
        {
            int mapId = 2;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap3"))
        {
            int mapId = 3;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap4"))
        {
            int mapId = 4;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap5"))
        {
            int mapId = 5;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap6"))
        {
            int mapId = 6;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap7"))
        {
            int mapId = 7;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap8"))
        {
            int mapId = 8;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap9"))
        {
            int mapId = 9;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap10"))
        {
            int mapId = 10;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap11"))
        {
            int mapId = 11;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap12"))
        {
            int mapId = 12;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap13"))
        {
            int mapId = 13;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap14"))
        {
            int mapId = 14;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap15"))
        {
            int mapId = 15;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap16"))
        {
            int mapId = 16;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap17"))
        {
            int mapId = 17;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap18"))
        {
            int mapId = 18;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap19"))
        {
            int mapId = 19;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap20"))
        {
            int mapId = 20;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap21"))
        {
            int mapId = 21;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap22"))
        {
            int mapId = 22;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap23"))
        {
            int mapId = 23;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap24"))
        {
            int mapId = 24;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }
        if (PlayerPrefs.HasKey("emap25"))
        {
            int mapId = 25;
            getEnemyStsAndMakeInstance(linkNo, mapId, rainMinusRatio, snowMinusRatio);
        }

        /*Dynamic Enemy Setting Finish*/
        //合戦開始エフェクト
        string     pathBack = "Prefabs/PreKassen/backGround";
        GameObject back     = Instantiate(Resources.Load(pathBack)) as GameObject;

        back.transform.localScale = new Vector2(30, 15);

        string     pathLight = "Prefabs/PreKassen/lightning";
        GameObject light     = Instantiate(Resources.Load(pathLight)) as GameObject;

        light.transform.localScale = new Vector2(10, 10);
    }
Esempio n. 16
0
	/*make engun instance*/
	public void makeEngunInstance(int busyoId, int hp, int atk, int dfc, int spd, ArrayList senpouArray, string busyoName, int ch_num, int ch_lv){
		
		/*Parent Instantiate*/
		string path = "Prefabs/Player/" + busyoId;
		GameObject prefab = Instantiate(Resources.Load (path)) as GameObject;
		
		//Senpou Script Parametor
		prefab.GetComponent<SenpouController>().senpouId = (int)senpouArray[0];
		prefab.GetComponent<SenpouController>().senpouTyp = senpouArray[1].ToString();
		prefab.GetComponent<SenpouController>().senpouName = senpouArray[2].ToString();
		prefab.GetComponent<SenpouController>().senpouEach = (float)senpouArray[4];
		prefab.GetComponent<SenpouController>().senpouRatio = (float)senpouArray[5];
		prefab.GetComponent<SenpouController>().senpouTerm = (float)senpouArray[6];
		prefab.GetComponent<SenpouController>().senpouStatus = (int)senpouArray[7];
		prefab.GetComponent<SenpouController>().senpouLv = (int)senpouArray[8];

		//Engun Flg
		prefab.GetComponent<Kunkou> ().engunFlg = true;

		/*Player Status Setting*/
		//parametor setting
		int adjHp = hp*100;
		int adjAtk = atk * 10;
		int adjDfc = dfc * 10;

		//Busyo Detail Info [Name & HP Bar]
		string dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
		GameObject dtl = Instantiate(Resources.Load (dtlPath)) as GameObject;
		dtl.transform.parent = prefab.transform;
		
		//Name
		GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;
		nameLabel.GetComponent<TextMesh> ().text = busyoName;
		
		//HP Bar
		GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;
		minHpBar.GetComponent<BusyoHPBar>().initLife = adjHp;
		
		//Location by map id
		prefab.transform.position = new Vector2 (-20, -16);
		prefab.GetComponent<LineLocation>().nowLine = 5;

		
		prefab.GetComponent<PlayerHP> ().life = adjHp;
		
		if (prefab.GetComponent<PlayerAttack> ()) {
			prefab.GetComponent<PlayerAttack> ().attack = adjAtk;
			prefab.GetComponent<Homing> ().speed = spd;
		} else {
			prefab.GetComponent<AttackLong> ().attack =  3 * adjAtk;
			prefab.GetComponent<HomingLong> ().speed = spd;
		}
		prefab.GetComponent<PlayerHP>().dfc = adjDfc;
		
		/*Child Instantiate*/
		//set child object
		BusyoInfoGet info = new BusyoInfoGet ();
		string ch_type = info.getHeisyu (busyoId);

		Entity_lvch_mst lvMst  = Resources.Load ("Data/lvch_mst") as Entity_lvch_mst;
		int startline = 0;
		if(ch_type=="KB"){
			startline = 0;
		}else if(ch_type=="YR"){
			startline = 1;
		}else if(ch_type=="TP"){
			startline = 2;
		}else if(ch_type=="YM"){
			startline = 3;
		}
		object stslst = lvMst.param[startline];
		Type t = stslst.GetType();
		String param = "lv" + ch_lv.ToString();
		FieldInfo f = t.GetField(param);
		int sts = (int)f.GetValue(stslst);

		float ch_status = (float)sts;
		
		string ch_path = "Prefabs/Player/" + ch_type;
		
		float y1 = 3.0f;
		float y2 = 3.0f;
		float y3 = 3.0f;
		float y4 = 3.0f;
		
		for(int i = 1; i <= ch_num; i++){
			//Make Relationship
			GameObject ch_prefab = Instantiate(Resources.Load (ch_path)) as GameObject;
			ch_prefab.transform.parent = prefab.transform;
			ch_prefab.name = ch_prefab.name + "_" + prefab.name;
			
			//Sashimono Making
			string sashimono_path = "Prefabs/Sashimono/" + busyoId;
			GameObject sashimono = Instantiate(Resources.Load (sashimono_path)) as GameObject;
			sashimono.transform.parent = ch_prefab.transform;
			sashimono.transform.localScale = new Vector2(0.3f,0.3f);
			
			
			if(ch_type == "YR"){
				sashimono.transform.localPosition = new Vector2(-1,0.6f);
				//Location
				if(i<6){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 3,prefab.transform.position.y + y1);
					y1 = y1 - 1.5f;
					
				}else if(5<i && i<11){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 6,prefab.transform.position.y + y2);
					y2 = y2 - 1.5f;
					
				}else if(10<i && i<16){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 9,prefab.transform.position.y + y3);
					y3 = y3 - 1.5f;
					
				}else if(15<i && i<21){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 12,prefab.transform.position.y + y4);
					y4 = y4 - 1.5f;
				}
			}else if(ch_type == "KB"){
				sashimono.transform.localPosition = new Vector2(-0.5f,1);
				//Location
				if(i<6){
					
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
					y1 = y1 - 1.5f;
					
				}else if(5<i && i<11){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
					y2 = y2 - 1.5f;
					
				}else if(10<i && i<16){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
					y3 = y3 - 1.5f;
					
				}else if(15<i && i<21){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
					y4 = y4 - 1.5f;
				}
			}else if(ch_type == "TP"){
				sashimono.transform.localPosition = new Vector2(-0.8f,0.5f);
				//Location
				if(i<6){
					
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
					y1 = y1 - 1.5f;
					
				}else if(5<i && i<11){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
					y2 = y2 - 1.5f;
					
				}else if(10<i && i<16){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
					y3 = y3 - 1.5f;
					
				}else if(15<i && i<21){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
					y4 = y4 - 1.5f;
				}
			}else if(ch_type == "YM"){
				sashimono.transform.localPosition = new Vector2(-0.8f,0.5f);
				//Location
				if(i<6){
					
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
					y1 = y1 - 1.5f;
					
				}else if(5<i && i<11){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
					y2 = y2 - 1.5f;
					
				}else if(10<i && i<16){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
					y3 = y3 - 1.5f;
					
				}else if(15<i && i<21){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
					y4 = y4 - 1.5f;
				}
			}
		}
		
	}
Esempio n. 17
0
    public void showBusyoZukan(GameObject Content)
    {
        //Prepare Master & History
        Entity_busyo_mst tempBusyoMst      = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        string           zukanBusyoHst     = PlayerPrefs.GetString("zukanBusyoHst");
        List <string>    zukanBusyoHstList = new List <string> ();

        char[] delimiterChars = { ',' };
        if (zukanBusyoHst != null && zukanBusyoHst != "")
        {
            if (zukanBusyoHst.Contains(","))
            {
                zukanBusyoHstList = new List <string> (zukanBusyoHst.Split(delimiterChars));
            }
            else
            {
                zukanBusyoHstList.Add(zukanBusyoHst);
            }
        }

        //add temporary daimyo busyo
        int    myDaimyo        = PlayerPrefs.GetInt("myDaimyo");
        Daimyo daimyo          = new Daimyo();
        int    myDaimyoBusyoId = daimyo.getDaimyoBusyoId(myDaimyo);

        if (!zukanBusyoHstList.Contains(myDaimyoBusyoId.ToString()))
        {
            zukanBusyoHstList.Add(myDaimyoBusyoId.ToString());
        }

        //Sort Master by daimyo
        Entity_busyo_mst busyoMst = new Entity_busyo_mst();

        busyoMst.param.AddRange(tempBusyoMst.param);
        busyoMst.param.Sort((a, b) => a.daimyoId - b.daimyoId);

        //Show busyo
        string path         = "Prefabs/Zukan/zukanBusyo";
        string nameRankPath = "Prefabs/Zukan/NameRank";

        int NowQty = 0;
        int AllQty = 0;

        for (int i = 0; i < busyoMst.param.Count; i++)
        {
            int daimyoId = busyoMst.param[i].daimyoId;
            if (daimyoId == 0)
            {
                daimyoId = busyoMst.param[i].daimyoHst;
            }

            if (daimyoId != 0)
            {
                AllQty = AllQty + 1;

                BusyoInfoGet busyoScript = new BusyoInfoGet();
                int          busyoId     = busyoMst.param[i].id;
                string       busyoName   = busyoScript.getName(busyoId);
                string       busyoRank   = busyoMst.param[i].rank;

                GameObject back = Instantiate(Resources.Load(path)) as GameObject;
                back.transform.SetParent(Content.transform);
                back.transform.localScale    = new Vector2(1, 1);
                back.transform.localPosition = new Vector3(0, 0, 0);

                GameObject kamon = back.transform.FindChild("kamon").gameObject;

                //Busyo Icon
                string     busyoPath = "Prefabs/Player/Unit/BusyoUnit";
                GameObject busyo     = Instantiate(Resources.Load(busyoPath)) as GameObject;
                busyo.name = busyoId.ToString();
                busyo.transform.SetParent(back.transform);
                busyo.transform.localScale = new Vector2(4, 4);
                busyo.GetComponent <DragHandler>().enabled = false;
                foreach (Transform n in busyo.transform)
                {
                    GameObject.Destroy(n.gameObject);
                }
                RectTransform busyoRect = busyo.GetComponent <RectTransform>();
                busyoRect.anchoredPosition3D = new Vector3(80, 80, 0);
                busyoRect.sizeDelta          = new Vector2(40, 40);

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

                //Name
                GameObject nameRank = Instantiate(Resources.Load(nameRankPath)) as GameObject;
                nameRank.transform.SetParent(back.transform);
                nameRank.transform.localScale    = new Vector2(1, 1);
                nameRank.transform.localPosition = new Vector3(0, 0, 0);


                GameObject rank = nameRank.transform.FindChild("Rank").gameObject;
                rank.GetComponent <Text>().text = busyoRank;


                //Have or not
                if (zukanBusyoHstList.Contains(busyoId.ToString()))
                {
                    NowQty = NowQty + 1;

                    GameObject name = nameRank.transform.FindChild("Name").gameObject;
                    name.GetComponent <Text>().text = busyoName;

                    int    hp        = busyoMst.param[i].hp;
                    int    atk       = busyoMst.param[i].atk;
                    int    dfc       = busyoMst.param[i].dfc;
                    int    spd       = busyoMst.param[i].spd;
                    string heisyu    = busyoMst.param[i].heisyu;
                    int    sendpouId = busyoMst.param[i].senpou_id;

                    PopInfo popScript = back.GetComponent <PopInfo>();
                    popScript.busyoId   = busyoId;
                    popScript.busyoName = busyoName;
                    popScript.hp        = hp;
                    popScript.atk       = atk;
                    popScript.dfc       = dfc;
                    popScript.spd       = spd;
                    popScript.heisyu    = heisyu;
                    popScript.daimyoId  = daimyoId;
                    popScript.senpouId  = sendpouId;
                }
                else
                {
                    Color noBusyoColor = new Color(0f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);                      //Black
                    Color backColor    = new Color(95f / 255f, 95f / 255f, 95f / 255f, 240f / 255f);                   //Black
                    Color kamonColor   = new Color(105f / 255f, 105f / 255f, 105f / 255f, 135f / 255f);                //Black

                    back.GetComponent <Image>().color    = backColor;
                    back.GetComponent <Button>().enabled = false;
                    busyo.GetComponent <Image>().color   = noBusyoColor;
                    kamon.GetComponent <Image>().color   = kamonColor;
                }
            }
        }

        //Qty
        float percent = (float)NowQty / (float)AllQty * 100;

        GameObject.Find("NowQty").GetComponent <Text> ().text = NowQty.ToString();
        GameObject.Find("AllQty").GetComponent <Text> ().text = AllQty.ToString() + "(" + percent.ToString("F1") + "%)";
    }
Esempio n. 18
0
	public void makeInstance(int busyoId, int mapId, int hp, int atk, int dfc,int spd, ArrayList senpouArray, string busyoName, int soudaisyo, int boubi){

		/*Parent Instantiate*/
		string path = "Prefabs/Player/" + busyoId;
		GameObject prefab = Instantiate(Resources.Load (path)) as GameObject;

		//Senpou Script Parametor
		prefab.GetComponent<SenpouController>().senpouId = (int)senpouArray[0];
		prefab.GetComponent<SenpouController>().senpouTyp = senpouArray[1].ToString();
		prefab.GetComponent<SenpouController>().senpouName = senpouArray[2].ToString();
		prefab.GetComponent<SenpouController>().senpouEach = (float)senpouArray[4];
		prefab.GetComponent<SenpouController>().senpouRatio = (float)senpouArray[5];
		prefab.GetComponent<SenpouController>().senpouTerm = (float)senpouArray[6];
		prefab.GetComponent<SenpouController>().senpouStatus = (int)senpouArray[7];
		prefab.GetComponent<SenpouController>().senpouLv = (int)senpouArray[8];

		/*Player Status Setting*/
		//parametor setting
		int adjHp = hp*100;
		int adjAtk = atk * 10;
		int adjDfc = dfc * 10;

		//heisyu
		BusyoInfoGet info = new BusyoInfoGet ();
		string heisyu = info.getHeisyu (busyoId);

		//Kahou Adjustment
		KahouStatusGet kahouSts = new KahouStatusGet();
		string[] KahouStatusArray =kahouSts.getKahouForStatus (busyoId.ToString(),adjHp,adjAtk,adjDfc,spd);

		//Kanni Adjustment
		string kanniTmp = "kanni" + busyoId;
		float addAtkByKanni = 0;
		float addHpByKanni = 0;
		float addDfcByKanni = 0;
		
		if (PlayerPrefs.HasKey (kanniTmp)) {
			int kanniId = PlayerPrefs.GetInt (kanniTmp);
			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;
			}
		}


		//Busyo Detail Info [Name & HP Bar]
		string dtlPath = "Prefabs/BusyoDtl/BusyoDtlPlayer";
		GameObject dtl = Instantiate(Resources.Load (dtlPath)) as GameObject;
		dtl.transform.parent = prefab.transform;
		
		//Name
		GameObject nameLabel = dtl.transform.FindChild("NameLabel").gameObject;
		nameLabel.GetComponent<TextMesh> ().text = busyoName;
		
		//HP Bar
		GameObject minHpBar = dtl.transform.FindChild("MinHpBar").gameObject;
		minHpBar.GetComponent<BusyoHPBar>().initLife = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt (addHpByKanni);


		//Location by map id
		if (mapId == 1) {
			prefab.transform.position = new Vector2 (-65, 16);
			prefab.GetComponent<LineLocation>().nowLine = 1;
		} else if (mapId == 2) {
			prefab.transform.position = new Vector2 (-50, 16);
			prefab.GetComponent<LineLocation>().nowLine = 1;
		} else if (mapId == 3) {
			prefab.transform.position = new Vector2 (-35, 16);
			prefab.GetComponent<LineLocation>().nowLine = 1;

		} else if (mapId == 4) {
			prefab.transform.position = new Vector2 (-20, 16);
			prefab.GetComponent<LineLocation>().nowLine = 1;

		} else if (mapId == 5) {
			prefab.transform.position = new Vector2 (-5, 16);
			prefab.GetComponent<LineLocation>().nowLine = 1;

		} else if (mapId == 6) {
			prefab.transform.position = new Vector2 (-65, 8);
			prefab.GetComponent<LineLocation>().nowLine = 2;

		} else if (mapId == 7) {
			prefab.transform.position = new Vector2 (-50, 8);
			prefab.GetComponent<LineLocation>().nowLine = 2;

		} else if (mapId == 8) {
			prefab.transform.position = new Vector2 (-35, 8);
			prefab.GetComponent<LineLocation>().nowLine = 2;

		} else if (mapId == 9) {
			prefab.transform.position = new Vector2 (-20, 8);
			prefab.GetComponent<LineLocation>().nowLine = 2;

		} else if (mapId == 10) {
			prefab.transform.position = new Vector2 (-5, 8);
			prefab.GetComponent<LineLocation>().nowLine = 2;

		} else if (mapId == 11) {
			prefab.transform.position = new Vector2 (-65, 0);
			prefab.GetComponent<LineLocation>().nowLine = 3;

		} else if (mapId == 12) {
			prefab.transform.position = new Vector2 (-50, 0);
			prefab.GetComponent<LineLocation>().nowLine = 3;

		} else if (mapId == 13) {
			prefab.transform.position = new Vector2 (-35, 0);
			prefab.GetComponent<LineLocation>().nowLine = 3;

		} else if (mapId == 14) {
			prefab.transform.position = new Vector2 (-20, 0);
			prefab.GetComponent<LineLocation>().nowLine = 3;

		} else if (mapId == 15) {
			prefab.transform.position = new Vector2 (-5, 0);
			prefab.GetComponent<LineLocation>().nowLine = 3;

		} else if (mapId == 16) {
			prefab.transform.position = new Vector2 (-65, -8);
			prefab.GetComponent<LineLocation>().nowLine = 4;

		} else if (mapId == 17) {
			prefab.transform.position = new Vector2 (-40, -8);
			prefab.GetComponent<LineLocation>().nowLine = 4;

		} else if (mapId == 18) {
			prefab.transform.position = new Vector2 (-35, -8);
			prefab.GetComponent<LineLocation>().nowLine = 4;

		} else if (mapId == 19) {
			prefab.transform.position = new Vector2 (-20, -8);
			prefab.GetComponent<LineLocation>().nowLine = 4;

		} else if (mapId == 20) {
			prefab.transform.position = new Vector2 (-5, -8);
			prefab.GetComponent<LineLocation>().nowLine = 4;

		} else if (mapId == 21) {
			prefab.transform.position = new Vector2 (-65, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;

		} else if (mapId == 22) {
			prefab.transform.position = new Vector2 (-50, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;

		} else if (mapId == 23) {
			prefab.transform.position = new Vector2 (-45, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;

		} else if (mapId == 24) {
			prefab.transform.position = new Vector2 (-20, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;

		} else if (mapId == 25) {
			prefab.transform.position = new Vector2 (-5, -16);
			prefab.GetComponent<LineLocation>().nowLine = 5;

		}

		int adjHpWithKahou = adjHp + int.Parse(KahouStatusArray[1]) + Mathf.FloorToInt (addHpByKanni);
		prefab.GetComponent<PlayerHP> ().life = adjHpWithKahou;

		if (prefab.GetComponent<PlayerAttack> ()) {
			prefab.GetComponent<PlayerAttack> ().attack = adjAtk + int.Parse(KahouStatusArray[0]) + Mathf.FloorToInt (addAtkByKanni);
			prefab.GetComponent<Homing> ().speed = spd + int.Parse(KahouStatusArray[3]);
		} else {
			if (heisyu == "TP") {
				prefab.GetComponent<AttackLong> ().attack = 5 * (adjAtk + int.Parse (KahouStatusArray [0]) + Mathf.FloorToInt (addAtkByKanni));
			} else if (heisyu == "YM") {
				prefab.GetComponent<AttackLong> ().attack = 3 * (adjAtk + int.Parse (KahouStatusArray [0]) + Mathf.FloorToInt (addAtkByKanni));
			}
			prefab.GetComponent<HomingLong> ().speed = spd + int.Parse(KahouStatusArray[3]);
		}

		prefab.GetComponent<PlayerHP>().dfc = adjDfc + int.Parse(KahouStatusArray[2]) + Mathf.FloorToInt (addDfcByKanni) + boubi;



		//Soudaisyo
		if (busyoId == soudaisyo) {
			prefab.GetComponent<PlayerHP> ().taisyo = true;
		}


		/*Child Instantiate*/
		//set child object
		string heiId = "hei" + busyoId.ToString();
		string chParam = PlayerPrefs.GetString(heiId,"0");

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

		string ch_type = ch_list[0];
		int ch_num = int.Parse (ch_list[1]);
		int ch_lv = int.Parse (ch_list[2]);
		float ch_status = float.Parse (ch_list[3]);
		ch_status = ch_status * 10;

		string ch_path = "Prefabs/Player/" + ch_type;

		float y1 = 3.0f;
		float y2 = 3.0f;
		float y3 = 3.0f;
		float y4 = 3.0f;

		for(int i = 1; i <= ch_num; i++){
			//Make Relationship
			GameObject ch_prefab = Instantiate(Resources.Load (ch_path)) as GameObject;
			ch_prefab.transform.parent = prefab.transform;
			ch_prefab.name = ch_prefab.name + "_" + prefab.name;

			//Sashimono Making
			string sashimono_path = "Prefabs/Sashimono/" + busyoId;
			GameObject sashimono = Instantiate(Resources.Load (sashimono_path)) as GameObject;
			sashimono.transform.parent = ch_prefab.transform;
			sashimono.transform.localScale = new Vector2(0.3f,0.3f);


			if(ch_type == "YR"){
				sashimono.transform.localPosition = new Vector2(-1,0.6f);
				//Location
				if(i<6){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 3,prefab.transform.position.y + y1);
					y1 = y1 - 1.5f;

				}else if(5<i && i<11){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 6,prefab.transform.position.y + y2);
					y2 = y2 - 1.5f;

				}else if(10<i && i<16){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 9,prefab.transform.position.y + y3);
					y3 = y3 - 1.5f;

				}else if(15<i && i<21){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 12,prefab.transform.position.y + y4);
					y4 = y4 - 1.5f;
				}
			}else if(ch_type == "KB"){
				sashimono.transform.localPosition = new Vector2(-0.5f,1);
				//Location
				if(i<6){

					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
					y1 = y1 - 1.5f;
					
				}else if(5<i && i<11){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
					y2 = y2 - 1.5f;
					
				}else if(10<i && i<16){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
					y3 = y3 - 1.5f;
					
				}else if(15<i && i<21){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
					y4 = y4 - 1.5f;
				}
			}else if(ch_type == "TP"){
				sashimono.transform.localPosition = new Vector2(-0.8f,0.5f);
				//Location
				if(i<6){
					
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
					y1 = y1 - 1.5f;
					
				}else if(5<i && i<11){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
					y2 = y2 - 1.5f;
					
				}else if(10<i && i<16){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
					y3 = y3 - 1.5f;
					
				}else if(15<i && i<21){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
					y4 = y4 - 1.5f;
				}
			}else if(ch_type == "YM"){
				sashimono.transform.localPosition = new Vector2(-0.8f,0.5f);
				//Location
				if(i<6){
					
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 4,prefab.transform.position.y + y1);
					y1 = y1 - 1.5f;
					
				}else if(5<i && i<11){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 7,prefab.transform.position.y + y2);
					y2 = y2 - 1.5f;
					
				}else if(10<i && i<16){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 10,prefab.transform.position.y + y3);
					y3 = y3 - 1.5f;
					
				}else if(15<i && i<21){
					ch_prefab.transform.position =  new Vector2(prefab.transform.position.x - 13,prefab.transform.position.y + y4);
					y4 = y4 - 1.5f;
				}
			}


			//Jyosyu Handling
			JyosyuHeiryoku jyosyuHei = new JyosyuHeiryoku ();
			float addHei = (float)jyosyuHei.GetJyosyuHeiryoku (busyoId.ToString());
			float addTotalHei = ch_status + addHei;

			StatusGet sts = new StatusGet();
			int atkDfc = (int)sts.getChAtkDfc((int)ch_status, adjHpWithKahou);

			ch_prefab.GetComponent<PlayerHP>().life = addTotalHei;
			if(ch_prefab.GetComponent<PlayerAttack> ()){
				ch_prefab.GetComponent<PlayerAttack> ().attack = atkDfc;
			}else{
				if (ch_type == "TP") {
					ch_prefab.GetComponent<AttackLong> ().attack = atkDfc * 5;
				} else if (ch_type == "YM") {
					ch_prefab.GetComponent<AttackLong> ().attack = atkDfc * 3;
				}
			}
			ch_prefab.GetComponent<PlayerHP>().dfc = atkDfc;
		}

	}
Esempio n. 19
0
    public void SyuppeiKuniScrollView(GameObject baseObj, string targetDaimyo, GameObject btn)
    {
        //View kuni which have openkuni

        GameObject content = baseObj.transform.FindChild("scroll").transform.FindChild("Content").gameObject;

        string seiryoku = PlayerPrefs.GetString("seiryoku");

        char[]        delimiterChars = { ',' };
        List <string> seiryokuList   = new List <string>();

        seiryokuList = new List <string> (seiryoku.Split(delimiterChars));

        //my kuni
        int        myDaimyo   = PlayerPrefs.GetInt("myDaimyo");
        string     myKuni     = PlayerPrefs.GetString("clearedKuni");
        List <int> myKuniList = new List <int>();

        if (myKuni.Contains(","))
        {
            List <string> tempMyKuniList = new List <string> (myKuni.Split(delimiterChars));
            myKuniList = tempMyKuniList.ConvertAll(x => int.Parse(x));
        }
        else
        {
            myKuniList.Add(int.Parse(myKuni));
        }

        //doumei daimyo's opne kuni
        KuniInfo   kuni = new KuniInfo();
        List <int> doumeiOpenKuniList = new List <int>();
        List <int> doumeiKuniList     = new List <int>();

        for (int i = 0; i < seiryokuList.Count; i++)
        {
            string tempDaimyo = seiryokuList[i];
            if (tempDaimyo == targetDaimyo)
            {
                int doumeiKuniId = i + 1;
                doumeiKuniList.Add(doumeiKuniId);
                doumeiOpenKuniList.AddRange(kuni.getMappingKuni(doumeiKuniId));
            }
        }

        //"doumei daimyo's doumei check
        string        tempDoumei = "doumei" + targetDaimyo;
        string        doumei     = PlayerPrefs.GetString(tempDoumei);
        List <string> doumeiList = new List <string>();

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


        //"doumei daimyo's opne kuni" minus "my kuni"  /minus Doumei's doumei
        List <int> doumeiOpenKuniMinusMyKuniList = new List <int>();

        foreach (int n in doumeiOpenKuniList)
        {
            if (!myKuniList.Contains(n))
            {
                if (!doumeiKuniList.Contains(n))
                {
                    if (doumeiList.Count != 0)
                    {
                        string checkDaimyoId = seiryokuList [n - 1];
                        if (!doumeiList.Contains(checkDaimyoId))
                        {
                            doumeiOpenKuniMinusMyKuniList.Add(n);
                        }
                    }
                    else
                    {
                        doumeiOpenKuniMinusMyKuniList.Add(n);
                    }
                }
            }
        }


        //delete duplication
        List <int> finalKuniList = new List <int>();

        for (int i = 0; i < doumeiOpenKuniMinusMyKuniList.Count; i++)
        {
            int tmpKuniId = doumeiOpenKuniMinusMyKuniList [i];

            if (!finalKuniList.Contains(tmpKuniId))
            {
                finalKuniList.Add(tmpKuniId);
            }
        }

        //Src Kuni List
        List <int> srcKuniList = new List <int>();

        for (int j = 0; j < finalKuniList.Count; j++)
        {
            int dstKuniId = finalKuniList [j];

            List <int> targetKuniList = new List <int>();
            targetKuniList.AddRange(kuni.getMappingKuni(dstKuniId));
            for (int k = 0; k < targetKuniList.Count; k++)
            {
                int srcKuniId = targetKuniList [k];
                if (doumeiKuniList.Contains(srcKuniId))
                {
                    srcKuniList.Add(srcKuniId);
                    break;
                }
            }
        }



        /*Slot making*/
        string temp      = "gaikou" + targetDaimyo;
        int    myYukoudo = PlayerPrefs.GetInt(temp);

        //Get Chiryaku
        //Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst;
        Daimyo       daimyoScript    = new Daimyo();
        int          myDaimyoBusyoId = daimyoScript.getDaimyoBusyoId(myDaimyo);
        BusyoInfoGet busyo           = new BusyoInfoGet();
        int          chiryaku        = busyo.getMaxDfc(myDaimyoBusyoId);

        string slotPath = "Prefabs/Map/common/kuniSlot";

        for (int i = 0; i < finalKuniList.Count; i++)
        {
            GameObject prefab = Instantiate(Resources.Load(slotPath)) as GameObject;
            prefab.transform.SetParent(content.transform);
            prefab.transform.localScale = new Vector3(1, 1, 1);

            int    kuniId        = finalKuniList[i];
            int    daimyoId      = int.Parse(seiryokuList [kuniId - 1]);
            string daimyoName    = daimyoScript.getName(daimyoId);
            int    srcKuniId     = srcKuniList [i];
            int    srcDaimyoId   = int.Parse(seiryokuList [srcKuniId - 1]);
            string srcDaimyoName = daimyoScript.getName(srcDaimyoId);

            string theirYukouTemp = "";
            if (int.Parse(targetDaimyo) < daimyoId)
            {
                theirYukouTemp = targetDaimyo + "gaikou" + daimyoId.ToString();
            }
            else
            {
                theirYukouTemp = daimyoId.ToString() + "gaikou" + targetDaimyo;
            }

            int theirYukoudo = PlayerPrefs.GetInt(theirYukouTemp);

            string kuniName = kuni.getKuniName(kuniId);
            prefab.transform.FindChild("KuniValue").GetComponent <Text>().text   = kuniName;
            prefab.transform.FindChild("DaimyoValue").GetComponent <Text>().text = daimyoName;
            prefab.GetComponent <GaikouKuniSelect>().Content = content;
            prefab.GetComponent <GaikouKuniSelect>().Btn     = btn;

            prefab.GetComponent <GaikouKuniSelect>().myYukoudo        = myYukoudo;
            prefab.GetComponent <GaikouKuniSelect>().chiryaku         = chiryaku;
            prefab.GetComponent <GaikouKuniSelect>().kuniDiff         = kuniDiff;
            prefab.GetComponent <GaikouKuniSelect>().theirYukoudo     = theirYukoudo;
            prefab.GetComponent <GaikouKuniSelect>().kuniName         = kuniName;
            prefab.GetComponent <GaikouKuniSelect>().targetKuniId     = kuniId;
            prefab.GetComponent <GaikouKuniSelect>().targetDaimyoId   = daimyoId;
            prefab.GetComponent <GaikouKuniSelect>().targetDaimyoName = daimyoName;
            prefab.GetComponent <GaikouKuniSelect>().srcKuniId        = srcKuniId;
            prefab.GetComponent <GaikouKuniSelect>().srcDaimyoId      = srcDaimyoId;
            prefab.GetComponent <GaikouKuniSelect>().srcDaimyoName    = srcDaimyoName;

            if (i == 0)
            {
                prefab.GetComponent <GaikouKuniSelect>().OnClick();
            }
        }

        if (finalKuniList.Count == 0)
        {
            string     msgPath = "Prefabs/Map/gaikou/NoKyoutouMsg";
            GameObject msg     = Instantiate(Resources.Load(msgPath)) as GameObject;
            msg.transform.SetParent(GameObject.Find("scroll").transform);
            msg.transform.localScale = new Vector3(0.17f, 0.2f, 1);
            RectTransform msgTransform = msg.GetComponent <RectTransform>();
            msgTransform.anchoredPosition = new Vector3(-260, -115, 0);
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                msg.GetComponent <Text>().text = "There is no available country.\nWe are surranded by allianced party.";
            }
            else
            {
                msg.GetComponent <Text>().text = "出兵可能な国はありませぬ\n周辺国は同盟大名しかおりませぬぞ";
            }

            GameObject a = baseObj.transform.FindChild("RequiredMoney").gameObject;
            GameObject b = baseObj.transform.FindChild("KyoutouRatio").gameObject;
            Destroy(a);
            Destroy(b);

            btn.GetComponent <Button>().enabled = false;
            Color NGClorBtn = new Color(133 / 255f, 133 / 255f, 80 / 255f, 255f / 255f);
            Color NGClorTxt = new Color(90 / 255f, 90 / 255f, 40 / 255f, 255f / 255f);
            btn.GetComponent <Image>().color = NGClorBtn;
            btn.transform.FindChild("Text").GetComponent <Text>().color = NGClorTxt;

            btn.transform.FindChild("hyourouIcon").GetComponent <Image>().color = NGClorBtn;
            btn.transform.FindChild("hyourouIcon").transform.FindChild("hyourouNoValue").GetComponent <Text>().color = NGClorTxt;
            btn.transform.FindChild("hyourouIcon").transform.FindChild("hyourouNoValue").transform.FindChild("syouhiText").GetComponent <Text>().color = NGClorTxt;
        }
    }
Esempio n. 20
0
    void Start()
    {
        viewCurrentValue();

        //Delete Previous Slot
        GameObject content = GameObject.Find("Content").gameObject;

        foreach (Transform obj in content.transform)
        {
            Destroy(obj.gameObject);
        }

        //Make Slot
        Shisya shisya   = new Shisya();
        Daimyo daimyo   = new Daimyo();
        bool   ClickFlg = false;

        for (int i = 1; i < 22; i++)
        {
            string tmp = "shisya" + i.ToString();
            if (PlayerPrefs.HasKey(tmp))
            {
                //Exist

                string        shisyaString   = PlayerPrefs.GetString(tmp);
                List <string> shisyaList     = new List <string> ();
                char[]        delimiterChars = { ',' };
                if (shisyaString != null && shisyaString != "")
                {
                    if (shisyaString.Contains(","))
                    {
                        shisyaList = new List <string> (shisyaString.Split(delimiterChars));
                    }
                    else
                    {
                        shisyaList.Add(shisyaString);
                    }
                }

                for (int j = 0; j < shisyaList.Count; j++)
                {
                    string shisyaParam = shisyaList [j];

                    List <string> shisyaParamList = new List <string> ();
                    char[]        delimiterChars2 = { ':' };
                    if (shisyaParam.Contains(":"))
                    {
                        shisyaParamList = new List <string> (shisyaParam.Split(delimiterChars2));
                    }
                    else
                    {
                        shisyaParamList.Add(shisyaParam);
                    }

                    //Common
                    string     slotName = shisya.getSlot(i);
                    string     slotPath = "Prefabs/Shisya/Slot/" + slotName;
                    GameObject slotObj  = Instantiate(Resources.Load(slotPath)) as GameObject;
                    slotObj.transform.SetParent(content.transform);
                    slotObj.transform.localScale    = new Vector2(1, 1);
                    slotObj.transform.localPosition = new Vector3(0, 0, 0);
                    string title = shisya.getName(i);
                    slotObj.transform.FindChild("Title").GetComponent <Text> ().text = title;
                    ShisyaSelect script = slotObj.GetComponent <ShisyaSelect> ();

                    if (slotName == "DaimyoSlot")
                    {
                        string daimyoId  = shisyaParamList [0];
                        string imagePath = "Prefabs/Kamon/" + daimyoId.ToString();
                        slotObj.transform.FindChild("Back").GetComponent <Image> ().sprite =
                            Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                        //Choose Buka
                        int daimyoBusyoId = daimyo.getDaimyoBusyoId(int.Parse(daimyoId));
                        int busyoId       = getRandomBusyo(int.Parse(daimyoId), daimyoBusyoId);

                        string busyoImagePath = "Prefabs/Player/Sprite/unit" + busyoId.ToString();
                        slotObj.transform.FindChild("Image").GetComponent <Image> ().sprite =
                            Resources.Load(busyoImagePath, typeof(Sprite)) as Sprite;

                        BusyoInfoGet busyo      = new BusyoInfoGet();
                        string       busyoName  = busyo.getName(busyoId);
                        string       daimyoName = daimyo.getName(int.Parse(daimyoId));
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            script.shisyaName = daimyoName + "'s retainer :" + busyoName;
                        }
                        else
                        {
                            script.shisyaName = daimyoName + "配下 " + busyoName;
                        }
                    }
                    else if (slotName == "SyogunSlot")
                    {
                        int           syogunId     = PlayerPrefs.GetInt("syogunDaimyoId");
                        string        seiryoku     = PlayerPrefs.GetString("seiryoku");
                        List <string> seiryokuList = new List <string> ();
                        seiryokuList = new List <string> (seiryoku.Split(delimiterChars));
                        if (seiryokuList.Contains(syogunId.ToString()))
                        {
                            string imagePath = "Prefabs/Kamon/" + syogunId.ToString();
                            slotObj.transform.FindChild("Back").GetComponent <Image> ().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                            string daimyoName = daimyo.getName(syogunId);
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                script.shisyaName = " Syogun " + daimyoName + "'s retainer";
                            }
                            else
                            {
                                script.shisyaName = "将軍" + daimyoName + "配下";
                            }
                        }
                        else
                        {
                            PlayerPrefs.DeleteKey("shisya" + i.ToString());
                        }
                    }
                    else
                    {
                        if (i == 13 || i == 15 || i == 16 || i == 17)
                        {
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                script.shisyaName = "Nobleman";
                            }
                            else
                            {
                                script.shisyaName = "貴族";
                            }
                        }
                        else if (i == 18)
                        {
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                script.shisyaName = "Merchant";
                            }
                            else
                            {
                                script.shisyaName = "商人";
                            }
                        }
                        else if (i == 19)
                        {
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                script.shisyaName = "Westerner";
                            }
                            else
                            {
                                script.shisyaName = "南蛮人";
                            }
                        }
                        else if (i == 20)
                        {
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                script.shisyaName = "Monk";
                            }
                            else
                            {
                                script.shisyaName = "僧";
                            }
                        }
                        else if (i == 21)
                        {
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                script.shisyaName = "Local Samurai";
                            }
                            else
                            {
                                script.shisyaName = "国人衆";
                            }
                        }
                    }


                    //Random Handling
                    string requried1 = shisya.getYesRequried1(i);
                    if (requried1 == "random")
                    {
                        randomMyKahouView(slotObj);
                    }
                    else if (requried1 == "randomKahou")
                    {
                        randomSalesKahouView(slotObj);
                    }


                    //Set Value
                    script.shisyaId = i;
                    script.title    = title;
                    script.Content  = content;

                    int    rdm    = UnityEngine.Random.Range(1, 4);              //1-3
                    string serihu = "";
                    if (rdm == 1)
                    {
                        serihu = shisya.getSerihu1(i);
                    }
                    else if (rdm == 2)
                    {
                        serihu = shisya.getSerihu2(i);
                    }
                    else if (rdm == 3)
                    {
                        serihu = shisya.getSerihu3(i);
                    }

                    serihu        = serihuChanger(i, serihu, shisyaParamList, slotObj);
                    script.serihu = serihu;


                    if (!ClickFlg)
                    {
                        ClickFlg  = true;
                        firstSlot = slotObj;
                    }
                }
            }
        }

        if (firstSlot != null)
        {
            firstSlot.GetComponent <ShisyaSelect> ().OnClick();
        }
        else
        {
            Application.LoadLevel("mainStage");
        }
    }
Esempio n. 21
0
	public void getEnemyStsAndMakeInstance(int linkNo, int mapId, float mntMinusRatio, float seaMinusRatio, float rainMinusRatio, float snowMinusRatio){
		
		String map = "emap" + mapId;
		int busyoId = PlayerPrefs.GetInt(map);

		int activeBusyoLv = PlayerPrefs.GetInt ("activeBusyoLv");
		int activeButaiQty = PlayerPrefs.GetInt ("activeButaiQty");
		int activeButaiLv = PlayerPrefs.GetInt ("activeButaiLv");

		StatusGet sts = new StatusGet ();
		BusyoInfoGet info = new BusyoInfoGet();
		int hp = sts.getHp (busyoId, activeBusyoLv);
		int atk = sts.getAtk (busyoId, activeBusyoLv);
		int dfc = sts.getDfc (busyoId, activeBusyoLv);
		int spd = sts.getSpd (busyoId, activeBusyoLv);
		string busyoName = sts.getBusyoName (busyoId);
		string heisyu = sts.getHeisyu (busyoId);
		ArrayList senpouArray = sts.getSenpou (busyoId);

		//Map & Weather Minus
		if (mntMinusRatio != 0) {
			if (heisyu == "KB") {
				float tmp = (float)spd * mntMinusRatio;
				if (tmp < 1) {
					tmp = 1;
				}
				spd = Mathf.FloorToInt (tmp);
			}
		}else if (seaMinusRatio != 0) {
			if (heisyu == "TP") {
				float tmp = (float)dfc * seaMinusRatio;
				if (tmp < 1) {
					tmp = 1;
				}
				dfc = Mathf.FloorToInt (tmp);
			}else if (heisyu == "YM") {
				float tmp = (float)dfc * seaMinusRatio;
				if (tmp < 1) {
					tmp = 1;
				}
				dfc = Mathf.FloorToInt (tmp);
			}
		}
		if (rainMinusRatio != 0) {
			if (heisyu == "TP") {
				float tmp = (float)atk * rainMinusRatio;
				if (tmp < 1) {
					tmp = 1;
				}
				atk = Mathf.FloorToInt (tmp);
			}else if (heisyu == "YM") {
				float tmp = (float)atk * rainMinusRatio;
				if (tmp < 1) {
					tmp = 1;
				}
				atk = Mathf.FloorToInt (tmp);
			}		
		}else if(snowMinusRatio != 0) {
			float tmp = (float)spd * 0.5f;
			if (tmp < 1) {
				tmp = 1;
			}
			spd = Mathf.FloorToInt (tmp);

			if (heisyu == "TP") {
				float tmp2 = (float)atk * snowMinusRatio;
				if (tmp2 < 1) {
					tmp2 = 1;
				}
				atk = Mathf.FloorToInt (tmp2);
			}else if (heisyu == "YM") {
				float tmp2 = (float)atk * snowMinusRatio;
				if (tmp2 < 1) {
					tmp2 = 1;
				}
				atk = Mathf.FloorToInt (tmp2);
			}else if (heisyu == "KB") {
				float tmp2 = (float)dfc * snowMinusRatio;
				if (tmp2 < 1) {
					tmp2 = 1;
				}
				dfc = Mathf.FloorToInt (tmp2);
			}
		}

		bool enemyTaisyoFlg = false;
		if (busyoId == enemySoudaisyo) {
			enemyTaisyoFlg = true;

		}

		//View Object & pass status to it. 
		EnemyInstance inst = new EnemyInstance ();
		inst.makeInstance(mapId, busyoId, activeButaiLv, heisyu, activeButaiQty, hp, atk, dfc, spd, busyoName,linkNo,enemyTaisyoFlg);
	}
Esempio n. 22
0
	public void createSyoguView(string busyoId){

		int lv = PlayerPrefs.GetInt (busyoId);

		Color ngImageColor = new Color (40f / 255f, 40f / 255f, 40f / 255f, 180f / 255f);
		Color ngTextColor = new Color (90f / 255f, 90f / 255f, 90f / 255f, 90f / 255f);
		Color okImageColor = new Color (255f / 255f, 255f / 255f, 255f / 255f, 150f / 255f);
		Color okTextColor = new Color (40f / 255f, 40f / 255f, 0f / 255f, 255f / 255f);
		
		GameObject kanjyo = GameObject.Find("kanjyo").gameObject;
		GameObject tsuihou = GameObject.Find("tsuihou").gameObject;

		int daimyoBusyoId = PlayerPrefs.GetInt ("myDaimyoBusyo");
		if (busyoId == daimyoBusyoId.ToString ()) {
			kanjyo.GetComponent<Image> ().color = ngImageColor; 
			kanjyo.transform.FindChild ("Text").GetComponent<Text> ().color = ngTextColor; 
			kanjyo.GetComponent<Button> ().enabled = false;

			tsuihou.GetComponent<Image> ().color = ngImageColor; 
			tsuihou.transform.FindChild ("Text").GetComponent<Text> ().color = ngTextColor; 
			tsuihou.GetComponent<Button> ().enabled = false;

		} else {

			if (lv != 100) {
				kanjyo.GetComponent<BusyoStatusButton> ().pa_lv = lv;
				kanjyo.GetComponent<Image> ().color = okImageColor; 
				kanjyo.transform.FindChild ("Text").GetComponent<Text> ().color = okTextColor;
				kanjyo.GetComponent<Button> ().enabled = true;
			} else {
				kanjyo.GetComponent<Image> ().color = ngImageColor; 
				kanjyo.transform.FindChild ("Text").GetComponent<Text> ().color = ngTextColor; 
				kanjyo.GetComponent<Button> ().enabled = false;
			}

			tsuihou.GetComponent<Image> ().color = okImageColor;
			tsuihou.transform.FindChild ("Text").GetComponent<Text> ().color = okTextColor; 
			tsuihou.GetComponent<Button> ().enabled = true;

		}
		
		GameObject kanni = GameObject.Find("kanni").gameObject;
		GameObject jyosyu = GameObject.Find("jyosyu").gameObject;
		GameObject syugyo = GameObject.Find("syugyo").gameObject;
		GameObject gokui = GameObject.Find("gokui").gameObject;
		kanni.GetComponent<RonkouKousyoMenu>().busyoId = busyoId;
		jyosyu.GetComponent<RonkouKousyoMenu>().busyoId = busyoId;
		syugyo.GetComponent<RonkouKousyoMenu>().busyoId = busyoId;
		gokui.GetComponent<RonkouKousyoMenu>().busyoId = busyoId;

		//Kanni
		string kanniTmp = "kanni" + busyoId;
		Kanni kanniScript = new Kanni();
		if (PlayerPrefs.HasKey (kanniTmp)) {
			int kanniId = PlayerPrefs.GetInt (kanniTmp);
			if (kanniId != 0) {
				foreach(Transform n in kanni.transform){
					if(n.name == "KanniName"){
						Destroy(n.gameObject);
					}
				}
				kanni.GetComponent<RonkouKousyoMenu> ().kanniId = kanniId;
				string path = "Prefabs/Busyo/KanniName";
				GameObject kanniName = Instantiate (Resources.Load (path)) as GameObject;
				kanniName.transform.SetParent (kanni.transform);
				kanniName.transform.localScale = new Vector2 (0.12f, 0.12f);
				kanniName.transform.localPosition = new Vector2 (0, 0);
				kanniName.name = "KanniName";

				string kanniNameString = kanniScript.getKanni(kanniId);
				string kanniIkai = kanniScript.getIkai(kanniId);
				kanniName.transform.FindChild("value").GetComponent<Text>().text = kanniIkai + "\t" + kanniNameString; 

				string effectLabel = kanniScript.getEffectLabel(kanniId);
				int effect = kanniScript.getEffect(kanniId);
				kanniName.transform.FindChild("effectLabel").GetComponent<Text>().text = effectLabel;
				kanniName.transform.FindChild("effectValue").GetComponent<Text>().text = "+" + effect.ToString() + "%"; 

				kanni.transform.FindChild ("Text").GetComponent<Text> ().enabled = false;
			}
		} else {
			foreach(Transform n in kanni.transform){
				if(n.name == "KanniName"){
					Destroy(n.gameObject);
				}
			}


			kanni.GetComponent<RonkouKousyoMenu> ().kanniId = 0;
			kanni.transform.FindChild ("Text").GetComponent<Text> ().enabled = true;
		}

		//Jyosyu
		string jyosyuTmp = "jyosyuBusyo" + busyoId;

		if (PlayerPrefs.HasKey (jyosyuTmp)) {
			BusyoInfoGet busyoInfo = new BusyoInfoGet ();
			string busyoName = busyoInfo.getName (int.Parse(busyoId));
			jyosyu.GetComponent<RonkouKousyoMenu>().jyosyuName = busyoName;

			int kuniId = PlayerPrefs.GetInt(jyosyuTmp);

			if(kuniId !=0){
				foreach(Transform n in jyosyu.transform){
					if(n.name == "JyosyuName"){
						Destroy(n.gameObject);
					}
				}

				KuniInfo kuni = new KuniInfo();
				string kuniName = kuni.getKuniName(kuniId);

				string jyosyuHeiTmp = "jyosyuHei" + busyoId;
				int jyosyuHei = PlayerPrefs.GetInt(jyosyuHeiTmp);

				jyosyu.GetComponent<RonkouKousyoMenu>().jyosyuKuniId = kuniId;
				string jyosyuPath = "Prefabs/Busyo/JyosyuName";
				GameObject jyosyuName = Instantiate (Resources.Load (jyosyuPath)) as GameObject;
				jyosyuName.transform.SetParent (jyosyu.transform);
				jyosyuName.transform.localScale = new Vector2 (0.12f, 0.12f);
				jyosyuName.transform.localPosition = new Vector2 (0, 0);
				jyosyuName.name = "JyosyuName";

				jyosyuName.transform.FindChild("value").GetComponent<Text>().text = kuniName; 
				jyosyuName.transform.FindChild("effectValue").GetComponent<Text>().text = "+" + jyosyuHei.ToString();
				
				jyosyu.transform.FindChild ("Text").GetComponent<Text> ().enabled = false;
			}			
		} else {
			foreach(Transform n in jyosyu.transform){
				if(n.name == "JyosyuName"){
					Destroy(n.gameObject);
				}
			}
			jyosyu.GetComponent<RonkouKousyoMenu> ().jyosyuKuniId = 0;
			jyosyu.transform.FindChild ("Text").GetComponent<Text> ().enabled = true;
		}




	}
Esempio n. 23
0
    public void kuniScrollView(GameObject baseObj, string targetDaimyo, GameObject btn)
    {
        GameObject content = baseObj.transform.FindChild("scroll").transform.FindChild("Content").gameObject;

        string seiryoku = PlayerPrefs.GetString("seiryoku");

        char[]        delimiterChars = { ',' };
        List <string> seiryokuList   = new List <string>();

        seiryokuList = new List <string> (seiryoku.Split(delimiterChars));

        //my kuni
        int        myDaimyo   = PlayerPrefs.GetInt("myDaimyo");
        string     myKuni     = PlayerPrefs.GetString("clearedKuni");
        List <int> myKuniList = new List <int>();

        if (myKuni.Contains(","))
        {
            List <string> tempMyKuniList = new List <string> (myKuni.Split(delimiterChars));
            myKuniList = tempMyKuniList.ConvertAll(x => int.Parse(x));
        }
        else
        {
            myKuniList.Add(int.Parse(myKuni));
        }

        //doumei daimyo's opne kuni
        KuniInfo   kuni = new KuniInfo();
        List <int> doumeiOpenKuniList = new List <int>();
        List <int> doumeiKuniList     = new List <int>();

        for (int i = 0; i < seiryokuList.Count; i++)
        {
            string tempDaimyo = seiryokuList[i];
            if (tempDaimyo == targetDaimyo)
            {
                int doumeiKuniId = i + 1;
                doumeiKuniList.Add(doumeiKuniId);
                doumeiOpenKuniList.AddRange(kuni.getMappingKuni(doumeiKuniId));
            }
        }

        //"doumei daimyo's opne kuni" minus "my kuni"
        List <int> doumeiOpenKuniMinusMyKuniList = new List <int>();

        foreach (int n in doumeiOpenKuniList)
        {
            if (!myKuniList.Contains(n))
            {
                doumeiOpenKuniMinusMyKuniList.Add(n);
            }
        }

        //"doumei daimyo's doumei check
        string        tempDoumei = "doumei" + targetDaimyo;
        string        doumei     = PlayerPrefs.GetString(tempDoumei);
        List <string> doumeiList = new List <string>();

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

        if (doumei != null && doumei != "")
        {
            for (int t = 0; t < doumeiOpenKuniMinusMyKuniList.Count; t++)
            {
                //foreach (int n in doumeiOpenKuniMinusMyKuniList) {
                string checkDaimyoId = seiryokuList [doumeiOpenKuniMinusMyKuniList[t] - 1];
                if (doumeiList.Contains(checkDaimyoId))
                {
                    doumeiOpenKuniMinusMyKuniList.Remove(doumeiOpenKuniMinusMyKuniList[t]);
                }
            }
        }



        //Compare "doumei open" with "my open"
        string     myOpenKuni     = PlayerPrefs.GetString("openKuni");
        List <int> myOpenKuniList = new List <int>();

        if (myOpenKuni.Contains(","))
        {
            List <string> tempMyOpenKuniList = new List <string> (myOpenKuni.Split(delimiterChars));
            myOpenKuniList = tempMyOpenKuniList.ConvertAll(x => int.Parse(x));
        }
        else
        {
            myOpenKuniList.Add(int.Parse(myOpenKuni));
        }

        List <int> sameTargetKuniList = new List <int>();

        foreach (int n in myOpenKuniList)
        {
            if (doumeiOpenKuniMinusMyKuniList.Contains(n))
            {
                if (!doumeiKuniList.Contains(n))
                {
                    if (!sameTargetKuniList.Contains(n))
                    {
                        sameTargetKuniList.Add(n);
                    }
                }
            }
        }


        /*Slot making*/
        string temp      = "gaikou" + targetDaimyo;
        int    myYukoudo = PlayerPrefs.GetInt(temp);

        //Get Chiryaku
        Daimyo            daimyoScript = new Daimyo();
        Entity_daimyo_mst daimyoMst    = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst;
        int          myDaimyoBusyoId   = daimyoMst.param [myDaimyo - 1].busyoId;
        BusyoInfoGet busyo             = new BusyoInfoGet();
        int          chiryaku          = busyo.getMaxDfc(myDaimyoBusyoId);
        //StatusGet sts = new StatusGet();
        //int lv = PlayerPrefs.GetInt (myDaimyoBusyoId.ToString());
        //float chiryaku = (float)sts.getDfc(myDaimyoBusyoId,lv);
        //chiryaku = chiryaku *10;


        string slotPath = "Prefabs/Map/common/kuniSlot";

        for (int i = 0; i < sameTargetKuniList.Count; i++)
        {
            GameObject prefab = Instantiate(Resources.Load(slotPath)) as GameObject;
            prefab.transform.SetParent(content.transform);
            prefab.transform.localScale = new Vector3(1, 1, 1);

            int kuniId   = sameTargetKuniList[i];
            int daimyoId = int.Parse(seiryokuList [kuniId - 1]);
            // daimyoName = daimyoMst.param [daimyoId - 1].daimyoName;
            string daimyoName = daimyoScript.getName(daimyoId);


            string theirYukouTemp = "";
            if (int.Parse(targetDaimyo) < daimyoId)
            {
                theirYukouTemp = targetDaimyo + "gaikou" + daimyoId.ToString();
            }
            else
            {
                theirYukouTemp = daimyoId.ToString() + "gaikou" + targetDaimyo;
            }

            int theirYukoudo = PlayerPrefs.GetInt(theirYukouTemp);

            string kuniName = kuni.getKuniName(kuniId);
            prefab.transform.FindChild("KuniValue").GetComponent <Text>().text   = kuniName;
            prefab.transform.FindChild("DaimyoValue").GetComponent <Text>().text = daimyoName;
            prefab.GetComponent <GaikouKuniSelect>().Content = content;
            prefab.GetComponent <GaikouKuniSelect>().Btn     = btn;

            prefab.GetComponent <GaikouKuniSelect>().myYukoudo    = myYukoudo;
            prefab.GetComponent <GaikouKuniSelect>().chiryaku     = chiryaku;
            prefab.GetComponent <GaikouKuniSelect>().kuniDiff     = kuniDiff;
            prefab.GetComponent <GaikouKuniSelect>().theirYukoudo = theirYukoudo;
            prefab.GetComponent <GaikouKuniSelect>().kuniName     = kuniName;
            prefab.GetComponent <GaikouKuniSelect>().targetKuniId = kuniId;

            if (i == 0)
            {
                prefab.GetComponent <GaikouKuniSelect>().OnClick();
            }
        }

        if (sameTargetKuniList.Count == 0)
        {
            string     msgPath = "Prefabs/Map/gaikou/NoKyoutouMsg";
            GameObject msg     = Instantiate(Resources.Load(msgPath)) as GameObject;
            msg.transform.SetParent(GameObject.Find("scroll").transform);
            msg.transform.localScale = new Vector3(0.17f, 0.2f, 1);
            RectTransform msgTransform = msg.GetComponent <RectTransform> ();
            msgTransform.anchoredPosition = new Vector3(-260, -115, 0);

            GameObject a = baseObj.transform.FindChild("RequiredMoney").gameObject;
            GameObject b = baseObj.transform.FindChild("KyoutouRatio").gameObject;
            Destroy(a);
            Destroy(b);

            btn.GetComponent <Button>().enabled = false;
            Color NGClorBtn = new Color(133 / 255f, 133 / 255f, 80 / 255f, 255f / 255f);
            Color NGClorTxt = new Color(90 / 255f, 90 / 255f, 40 / 255f, 255f / 255f);
            btn.GetComponent <Image>().color = NGClorBtn;
            btn.transform.FindChild("Text").GetComponent <Text>().color = NGClorTxt;

            btn.transform.FindChild("hyourouIcon").GetComponent <Image>().color = NGClorBtn;
            btn.transform.FindChild("hyourouIcon").transform.FindChild("hyourouNoValue").GetComponent <Text>().color = NGClorTxt;
            btn.transform.FindChild("hyourouIcon").transform.FindChild("hyourouNoValue").transform.FindChild("syouhiText").GetComponent <Text>().color = NGClorTxt;
        }
    }
Esempio n. 24
0
	public void OnClick(){

		BusyoStatusButton bsb = new BusyoStatusButton ();

		if (name == "kanni") {
			if(kanniId ==0){
				string myKanni = PlayerPrefs.GetString("myKanni");

				if(myKanni != null && myKanni !=""){

					bsb.commonPopup ();
					GameObject.Find ("popText").GetComponent<Text> ().text ="官位一覧";
					
					string scrollPath = "Prefabs/Busyo/KanniScrollView";
					GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject;
					scroll.transform.SetParent(GameObject.Find ("board(Clone)").transform);
					scroll.transform.localScale = new Vector2 (1, 1);
					scroll.name = "KanniScrollView";
					RectTransform scrollTransform = scroll.GetComponent<RectTransform> ();
					scrollTransform.anchoredPosition3D = new Vector3 (0, 0, 0);

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

					if(myKanni.Contains(",")){
						char[] delimiterChars = {','};
						myKanniList = new List<string> (myKanni.Split (delimiterChars));
					}else{
						myKanniList.Add(myKanni);
					}

					myKanniList.Sort();

					string pathSlot = "Prefabs/Busyo/KanniSlot";
					Kanni kanni = new Kanni();
					GameObject content = scroll.transform.FindChild("KanniContent").gameObject;
					for(int i=0; i<myKanniList.Count; i++){
						GameObject slot = Instantiate (Resources.Load (pathSlot)) as GameObject;
						slot.transform.SetParent(content.transform);
						slot.transform.localScale = new Vector2 (1, 1);

						int kanniIdTmp = int.Parse(myKanniList[i]);
						string kanniName = kanni.getKanni(kanniIdTmp);
						string kanniIkai = kanni.getIkai(kanniIdTmp);
						string EffectLabel = kanni.getEffectLabel(kanniIdTmp);
						int effect = kanni.getEffect(kanniIdTmp);

						slot.transform.FindChild("Name").GetComponent<Text>().text = kanniIkai + "\t" + kanniName;
						slot.transform.FindChild("EffectLabel").GetComponent<Text>().text = EffectLabel;
						slot.transform.FindChild("EffectValue").GetComponent<Text>().text = "+" + effect.ToString() + "%";

						GameObject btn = slot.transform.FindChild("GiveButton").gameObject;
						btn.GetComponent<GiveKanni>().busyoId = busyoId;
						btn.GetComponent<GiveKanni>().kanniId = kanniIdTmp;

					}



				}else{
					Message msg = new Message();
					msg.makeMessage("官位を持っておりませんぞ。\n山城国にある朝廷を訪れてみましょう。");
				}
			}else{

				string backPath = "Prefabs/Busyo/back";
				GameObject back = Instantiate (Resources.Load (backPath)) as GameObject;
				back.transform.SetParent(GameObject.Find ("Panel").transform);
				back.transform.localScale = new Vector2 (1, 1);
				RectTransform backTransform = back.GetComponent<RectTransform> ();
				backTransform.anchoredPosition3D = new Vector3 (0, 0, 0);

				string removePath = "Prefabs/Busyo/KanniRemoveConfirm";
				GameObject remove = Instantiate (Resources.Load (removePath)) as GameObject;
				remove.transform.SetParent(GameObject.Find ("Panel").transform);
				remove.transform.localScale = new Vector2 (1, 1);
				remove.transform.localPosition = new Vector3(0,0,0);
				remove.name = "KanniRemoveConfirm";
				BusyoInfoGet busyo = new BusyoInfoGet();
				string busyoName = busyo.getName(int.Parse(busyoId));
				remove.transform.FindChild("YesButton").GetComponent<DoRemoveKanni>().busyoId = busyoId;
				remove.transform.FindChild("RemoveText").GetComponent<Text>().text = busyoName + "殿の官位を\n罷免なさるのですか?";

			}



		}else if(name == "jyosyu"){
			if(jyosyuKuniId ==0){
				//Available Kuni

				string openKuniString = PlayerPrefs.GetString ("openKuni");
				char[] delimiterChars = {','};
				List<string> openKuniList = new List<string> ();
				if (openKuniString.Contains (",")) {
					openKuniList = new List<string> (openKuniString.Split (delimiterChars));
				} else {
					openKuniList.Add(openKuniString);
				}

				List<string> okKuniList = new List<string> ();
				for (int i=0; i<openKuniList.Count; i++) {
					int kuniId = int.Parse(openKuniList[i]);
					string temp = "kuni" + kuniId.ToString();
					string clearedKuni = PlayerPrefs.GetString (temp);
					//Shiro Qty
					if(clearedKuni != null && clearedKuni != ""){
						//Jyosyu Exist Check
						string jyosyuTmp = "jyosyu" + kuniId.ToString();
						if(!PlayerPrefs.HasKey(jyosyuTmp)){
							okKuniList.Add(kuniId.ToString());
						}
					}
				}

				if(okKuniList.Count != 0){
					bsb.commonPopup ();
					GameObject.Find ("popText").GetComponent<Text> ().text ="国一覧";
					
					string scrollPath = "Prefabs/Busyo/KanniScrollView";
					GameObject scroll = Instantiate (Resources.Load (scrollPath)) as GameObject;
					scroll.transform.SetParent(GameObject.Find ("board(Clone)").transform);
					scroll.transform.localScale = new Vector2 (1, 1);
					scroll.name = "KanniScrollView";
					RectTransform scrollTransform = scroll.GetComponent<RectTransform> ();
					scrollTransform.anchoredPosition3D = new Vector3 (0, 0, 0);

					string pathSlot = "Prefabs/Busyo/ShiroSlot";
					GameObject content = scroll.transform.FindChild("KanniContent").gameObject;
					KuniInfo kuni = new KuniInfo();
					for(int i=0; i<okKuniList.Count; i++){

						GameObject slot = Instantiate (Resources.Load (pathSlot)) as GameObject;
						slot.transform.SetParent(content.transform);
						slot.transform.localScale = new Vector2 (1, 1);
						
						int kuniId = int.Parse(okKuniList[i]);
						string kuniName = kuni.getKuniName(kuniId);

						slot.transform.FindChild("Name").GetComponent<Text>().text = kuniName;


						//Status
						int jyosyuHei = 0;
						string naiseiTemp = "naisei" + kuniId.ToString();
						string naiseiString = PlayerPrefs.GetString (naiseiTemp);

						List<string> naiseiList = new List<string>();
						naiseiList = new List<string>(naiseiString.Split (delimiterChars));
						char[] delimiterChars2 = {':'};
						Entity_naisei_mst naiseiMst = Resources.Load ("Data/naisei_mst") as Entity_naisei_mst;
						NaiseiController naisei = new NaiseiController();


						string shiroLv = naiseiList[0];
						List<int> shiroEffectList = new List<int>();
						shiroEffectList = naisei.getNaiseiList("shiro", int.Parse(shiroLv));
						jyosyuHei = shiroEffectList[0];

						for(int j=1; j<naiseiList.Count;j++){
							List<string> naiseiContentList = new List<string>();
							naiseiContentList = new List<string>(naiseiList[j].Split (delimiterChars2));

							if(naiseiContentList[0] != "0"){
								string type = naiseiMst.param [int.Parse(naiseiContentList[0])].code;
								if(type == "hsy"){
									List<int> naiseiEffectList = new List<int>();
									naiseiEffectList = naisei.getNaiseiList(type, int.Parse(naiseiContentList[1]));

									jyosyuHei = jyosyuHei + naiseiEffectList[0];
								}

							}
						}


						slot.transform.FindChild("EffectValue").GetComponent<Text>().text = "+" + jyosyuHei.ToString();
						
						GameObject btn = slot.transform.FindChild("GiveButton").gameObject;
						btn.GetComponent<DoNinmei>().busyoId = busyoId;
						btn.GetComponent<DoNinmei>().kuniId = kuniId;
						btn.GetComponent<DoNinmei>().jyosyuHei = jyosyuHei;
					}



				}else{
					Message msg = new Message();
					msg.makeMessage("任命可能な国はありませんぞ。\nまずは城を落としなされ。");
				}




			}else{
				string backPath = "Prefabs/Common/TouchBack";
				GameObject back = Instantiate (Resources.Load (backPath)) as GameObject;
				back.transform.SetParent(GameObject.Find ("Panel").transform);
				back.transform.localScale = new Vector2 (1, 1);
				RectTransform backTransform = back.GetComponent<RectTransform> ();
				backTransform.anchoredPosition3D = new Vector3 (0, 0, 0);
				back.name = "TouchBack";

				//Message Box
				string msgPath = "Prefabs/Naisei/KaininConfirm";
				GameObject msg = Instantiate (Resources.Load (msgPath)) as GameObject;
				msg.transform.SetParent(back.transform);
				msg.transform.localScale = new Vector2 (1, 1);
				RectTransform msgTransform = msg.GetComponent<RectTransform> ();
				msgTransform.anchoredPosition3D = new Vector3 (0, 0, 0);
				msgTransform.name = "kaininConfirm";
				msg.transform.FindChild("YesButton").GetComponent<DoKainin>().kuniId = jyosyuKuniId;


				//Message Text Mod
				GameObject msgObj = msg.transform.FindChild ("KaininText").gameObject;
				int myDaimyoBusyo = PlayerPrefs.GetInt ("myDaimyoBusyo");
				string msgText = msgObj.GetComponent<Text> ().text;
				if (myDaimyoBusyo == int.Parse(busyoId)) {
					msgText = msgText.Replace("A殿を", "自らを");
				} else {
					msgText = msgText.Replace("A", jyosyuName);
				}
				msgObj.GetComponent<Text> ().text = msgText;
			}

		}


	}
Esempio n. 25
0
    public void OnClick()
    {
        if (close.GetComponent <CloseBoard> ().kuniId != kuniId)
        {
            close.GetComponent <CloseBoard> ().kuniId = kuniId;

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

            /*Status*/
            //Common
            GameObject kuniIconView   = GameObject.Find("KuniIconView").gameObject;
            SendParam  script         = kuniIconView.transform.FindChild(kuniId.ToString()).GetComponent <SendParam> ();
            KuniInfo   kuni           = new KuniInfo();
            Daimyo     daimyo         = new Daimyo();
            Gaikou     gaikou         = new Gaikou();
            List <int> targetKuniList = new List <int> ();
            targetKuniList = kuni.getMappingKuni(kuniId);
            char[] delimiterChars = { ',' };

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

            //Daimyo Name
            daimyoNameObj.transform.FindChild("Value").GetComponent <Text> ().text = daimyoName;

            //Kuni Name
            GameObject kuniNameObj = status.transform.FindChild("KuniName").gameObject;
            kuniNameObj.transform.FindChild("Value").GetComponent <Text> ().text = kuniName;

            //Heiryoku
            status.transform.FindChild("Heiryoku").transform.FindChild("Value").GetComponent <Text> ().text = script.heiryoku.ToString();

            //Yukou
            status.transform.FindChild("Yukoudo").transform.FindChild("Value").GetComponent <Text> ().text = script.myYukouValue.ToString();

            //Attack Target
            bool aggressiveFlg = script.aggressiveFlg;
            int  myDaimyoId    = PlayerPrefs.GetInt("myDaimyo");

            int targetKuniId   = getKassenTargetKuni(kuniId, daimyoId, targetKuniList, kuniIconView, aggressiveFlg, seiryokuList, myDaimyoId);
            int targetDaimyoId = 0;
            if (targetKuniId != 0)
            {
                string targetKuniName = kuni.getKuniName(targetKuniId);
                targetDaimyoId = int.Parse(seiryokuList [targetKuniId - 1]);
                string targetDaimyoName = daimyo.getName(targetDaimyoId);
                status.transform.FindChild("Atk").transform.FindChild("Value").GetComponent <Text> ().text = targetKuniName + "(" + targetDaimyoName + ")";
            }
            else
            {
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    status.transform.FindChild("Atk").transform.FindChild("Value").GetComponent <Text>().text = "None";
                }
                else
                {
                    status.transform.FindChild("Atk").transform.FindChild("Value").GetComponent <Text> ().text = "無し";
                }
            }


            int targetGaikouKuniId = 0;
            if (snbRank > 1)               //Jyo or Cyu

            //Gaikou
            {
                targetGaikouKuniId = getGaikouTargetKuni(kuniId, daimyoId, targetKuniList, kuniIconView, aggressiveFlg, seiryokuList, myDaimyoId);
                if (targetGaikouKuniId != 0)
                {
                    string targetGaikouKuniName   = kuni.getKuniName(targetGaikouKuniId);
                    int    targetGaikouDaimyoId   = int.Parse(seiryokuList [targetGaikouKuniId - 1]);
                    string targetGaikouDaimyoName = daimyo.getName(targetGaikouDaimyoId);

                    if (targetDaimyoId != targetGaikouDaimyoId)
                    {
                        status.transform.FindChild("Gaiko").transform.FindChild("Value").GetComponent <Text> ().text = targetGaikouKuniName + "(" + targetGaikouDaimyoName + ")";
                    }
                    else
                    {
                        sameDaimyoFlg = true;
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            status.transform.FindChild("Gaiko").transform.FindChild("Value").GetComponent <Text>().text = "None";
                        }
                        else
                        {
                            status.transform.FindChild("Gaiko").transform.FindChild("Value").GetComponent <Text> ().text = "無し";
                        }
                    }
                }
                else
                {
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        status.transform.FindChild("Gaiko").transform.FindChild("Value").GetComponent <Text>().text = "None";
                    }
                    else
                    {
                        status.transform.FindChild("Gaiko").transform.FindChild("Value").GetComponent <Text>().text = "無し";
                    }
                }

                //Doumei
                string        doumeiTmp    = "doumei" + daimyoId.ToString();
                string        doumeiString = PlayerPrefs.GetString(doumeiTmp);
                List <string> doumeiList   = new List <string> ();
                if (doumeiString != null && doumeiString != "")
                {
                    if (doumeiString.Contains(","))
                    {
                        doumeiList = new List <string> (doumeiString.Split(delimiterChars));
                    }
                    else
                    {
                        doumeiList.Add(doumeiString);
                    }
                }


                //Exist Check
                if (doumeiList.Count != 0)
                {
                    List <string> doumeiListTmp = new List <string> (doumeiList);
                    for (int j = 0; j < doumeiListTmp.Count; j++)
                    {
                        string doumeiDaimyoId = doumeiListTmp [j];
                        if (!seiryokuList.Contains(doumeiDaimyoId))
                        {
                            doumeiList.Remove(doumeiDaimyoId);
                        }
                    }
                }
                string doumeiNameList = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    doumeiNameList = "None";
                }
                else
                {
                    doumeiNameList = "無し";
                }

                for (int j = 0; j < doumeiList.Count; j++)
                {
                    if (j == 0)
                    {
                        doumeiNameList = daimyo.getName(int.Parse(doumeiList [j]));
                    }
                    else
                    {
                        doumeiNameList = doumeiNameList + "," + daimyo.getName(int.Parse(doumeiList [j]));
                    }
                }

                status.transform.FindChild("Doumei").transform.FindChild("Value").GetComponent <Text> ().text = doumeiNameList;
            }
            else
            {
                //Ge
                status.transform.FindChild("Gaiko").transform.FindChild("Value").GetComponent <Text> ().text  = "?";
                status.transform.FindChild("Doumei").transform.FindChild("Value").GetComponent <Text> ().text = "?";
            }


            if (snbRank > 2)               //Jyo
            {
                BusyoInfoGet busyo = new BusyoInfoGet();

                string        qtyAndHeisyu      = busyo.getDaimyoBusyoQtyHeisyu(daimyoId);
                List <string> qtyAndHeisyuiList = new List <string> ();
                qtyAndHeisyuiList = new List <string> (qtyAndHeisyu.Split(delimiterChars));

                //BusyoQty
                //Heisyu
                status.transform.FindChild("BusyoQty").transform.FindChild("Value").GetComponent <Text> ().text = qtyAndHeisyuiList[0];
                status.transform.FindChild("Heisyu").transform.FindChild("Value").GetComponent <Text> ().text   = qtyAndHeisyuiList[1];
            }
            else
            {
                //Cyu or Ge
                status.transform.FindChild("BusyoQty").transform.FindChild("Value").GetComponent <Text> ().text = "?";
                status.transform.FindChild("Heisyu").transform.FindChild("Value").GetComponent <Text> ().text   = "?";
            }


            //Main Map
            foreach (Transform obj in board.transform)
            {
                if (obj.name != "Explanation")
                {
                    Destroy(obj.gameObject);
                }
            }


            //Create Map
            GameObject originalKuniMap = GameObject.Find("KuniMap");
            GameObject copiedKuniMap   = Object.Instantiate(originalKuniMap) as GameObject;
            copiedKuniMap.transform.SetParent(board.transform);
            copiedKuniMap.transform.localScale = new Vector2(1, 0.8f);
            Vector3       vect    = copiedKuniMap.transform.FindChild(kuniId.ToString()).transform.localPosition;
            float         adjstX  = vect.x * -1;
            float         adjustY = vect.y * -1;
            RectTransform mapRect = copiedKuniMap.GetComponent <RectTransform>();
            mapRect.anchoredPosition3D = new Vector3(adjstX, adjustY, 0);

            //Create Kamon
            GameObject originalKamon = GameObject.Find("KuniIconView");
            GameObject copiedKamon   = Object.Instantiate(originalKamon) as GameObject;
            copiedKamon.transform.SetParent(board.transform);
            copiedKamon.transform.localScale = new Vector2(1, 0.8f);
            RectTransform kamonRect = copiedKamon.GetComponent <RectTransform>();
            kamonRect.anchoredPosition3D = new Vector3(adjstX, adjustY, 0);

            Entity_kuni_mst kuniMst    = Resources.Load("Data/kuni_mst") as Entity_kuni_mst;
            Color           whiteColor = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
            for (int i = 0; i < kuniMst.param.Count; i++)
            {
                int subKuniId = i + 1;

                GameObject tmpKuniObj  = copiedKuniMap.transform.FindChild(subKuniId.ToString()).gameObject;
                GameObject tmpKamonObj = copiedKamon.transform.FindChild(subKuniId.ToString()).gameObject;
                tmpKamonObj.GetComponent <Image>().color = whiteColor;

                if (subKuniId == kuniId)
                {
                    tmpKamonObj.GetComponent <Button>().enabled = false;
                    tmpKamonObj.GetComponent <Image>().sprite   =
                        Resources.Load(imagePath, typeof(Sprite)) as Sprite;

                    //EFFECT
                    string     effectPath = "Prefabs/EffectAnime/point_up";
                    GameObject pointUp    = Instantiate(Resources.Load(effectPath)) as GameObject;
                    pointUp.transform.SetParent(tmpKamonObj.transform);
                    pointUp.transform.localScale             = new Vector2(70, 70);
                    pointUp.transform.localPosition          = new Vector2(0, 25);
                    pointUp.GetComponent <Fadeout>().enabled = false;
                }
                else
                {
                    if (targetKuniList.Contains(subKuniId))
                    {
                        tmpKamonObj.GetComponent <Button>().enabled = false;
                        int subDaimyoId = int.Parse(seiryokuList[subKuniId - 1]);

                        if (daimyoId != subDaimyoId)
                        {
                            //yukoudo
                            int        yukoudoValue = gaikou.getExistGaikouValue(daimyoId, subDaimyoId);
                            string     syukoudoPath = "Prefabs/Map/cyouhou/YukoudoLabel";
                            GameObject yukoudoObj   = Instantiate(Resources.Load(syukoudoPath)) as GameObject;
                            yukoudoObj.transform.SetParent(tmpKamonObj.transform);
                            yukoudoObj.GetComponent <Text>().text = yukoudoValue.ToString();
                            yukoudoObj.transform.localScale       = new Vector2(0.08f, 0.1f);
                            yukoudoObj.transform.localPosition    = new Vector2(0, 26);
                        }
                        else
                        {
                            tmpKamonObj.GetComponent <Image>().sprite =
                                Resources.Load(imagePath, typeof(Sprite)) as Sprite;
                        }

                        if (targetKuniId != 0)
                        {
                            if (targetKuniId == subKuniId)
                            {
                                //kassen target
                                Color atkColor = new Color(180f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
                                tmpKamonObj.GetComponent <Image>().color = atkColor;
                            }
                        }
                        if (snbRank > 1)
                        {
                            if (targetGaikouKuniId != 0)
                            {
                                if (targetGaikouKuniId == subKuniId)
                                {
                                    if (!sameDaimyoFlg)
                                    {
                                        //gaikou target
                                        Color gaikouColor = new Color(80f / 255f, 100f / 255f, 185f / 255f, 255f / 255f);
                                        tmpKamonObj.GetComponent <Image>().color = gaikouColor;
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        Color noSubKuniColor = new Color(255f / 255f, 255f / 255f, 255f / 255f, 40f / 255f);
                        tmpKuniObj.GetComponent <Image>().color = noSubKuniColor;

                        tmpKamonObj.SetActive(false);
                    }
                }
            }

            /*
             * string kuniMapPath = "Prefabs/Map/cyouhou/kuniImage";
             * GameObject mainMap = Instantiate (Resources.Load (kuniMapPath)) as GameObject;
             * mainMap.transform.SetParent(board.transform);
             * mainMap.transform.localScale = new Vector2 (13, 9);
             * mainMap.name = "kuniMap" + kuniId;
             * string kuniImagePath = "Prefabs/Map/kuniMap/" + kuniId.ToString ();
             * mainMap.GetComponent<Image> ().sprite =
             *  Resources.Load (kuniImagePath, typeof(Sprite)) as Sprite;
             *
             * int baseX = kuni.getKuniLocationX (kuniId);
             * int baseY = kuni.getKuniLocationY (kuniId);
             * int adjstX = baseX * -1;
             * int adjustY = baseY * -1;
             *
             * float colorR = daimyo.getColorR (daimyoId);
             * float colorG = daimyo.getColorG (daimyoId);
             * float colorB = daimyo.getColorB (daimyoId);
             * Color kuniColor = new Color (colorR / 255f, colorG / 255f, colorB / 255f, 255f / 255f);
             * mainMap.GetComponent<Image> ().color = kuniColor;
             *
             * RectTransform mapRect = mainMap.GetComponent<RectTransform> ();
             * mapRect.anchoredPosition3D = new Vector3 (adjstX, adjustY, 0);
             *
             * //My Kuni Kamon Icon
             * string kamonBackPath ="Prefabs/Map/cyouhou/KamonBack";
             * GameObject kamonBack = Instantiate (Resources.Load (kamonBackPath)) as GameObject;
             * kamonBack.transform.SetParent (board.transform);
             * kamonBack.transform.localScale = new Vector2 (1, 1);
             * kamonBack.transform.localPosition = new Vector2(0,0);
             *
             * string kamonKuniPath = "Prefabs/Map/Kuni/" + kuniId.ToString();
             * GameObject kamonObj = Instantiate (Resources.Load (kamonKuniPath)) as GameObject;
             * kamonObj.transform.SetParent (kamonBack.transform);
             * kamonObj.transform.localScale = new Vector2 (1, 0.8f);
             * kamonObj.transform.localPosition = new Vector2(0,0);
             * kamonObj.GetComponent<Image> ().sprite =
             *  Resources.Load (imagePath, typeof(Sprite)) as Sprite;
             * kamonObj.GetComponent<Button> ().enabled = false;
             *
             *
             * //Mapping Kuni
             * Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst;
             * for (int i=0; i < kuniMst.param.Count; i++) {
             * //for (int i=0; i < targetKuniList.Count; i++) {
             *  int subKuniId = i + 1;
             *
             *  GameObject subMap = Instantiate (Resources.Load (kuniMapPath)) as GameObject;
             *  subMap.transform.SetParent(mainMap.transform);
             *  subMap.transform.localScale = new Vector2 (1, 1);
             *  subMap.transform.localPosition = new Vector2 (0, 0);
             *
             *  subMap.name = "kuniMap" + subKuniId;
             *  string subKuniImagePath = "Prefabs/Map/kuniMap/" + subKuniId;
             *  subMap.GetComponent<Image> ().sprite =
             *      Resources.Load (subKuniImagePath, typeof(Sprite)) as Sprite;
             *
             *
             *  if (targetKuniList.Contains (subKuniId)) {
             *      //color
             *      int subDaimyoId = int.Parse (seiryokuList [subKuniId - 1]);
             *      float subColorR = daimyo.getColorR (subDaimyoId);
             *      float subColorG = daimyo.getColorG (subDaimyoId);
             *      float subColorB = daimyo.getColorB (subDaimyoId);
             *      Color subKuniColor = new Color (subColorR / 255f, subColorG / 255f, subColorB / 255f, 255f / 255f);
             *      subMap.GetComponent<Image> ().color = subKuniColor;
             *
             *      //Kamon
             *      string subKamonKuniPath = "Prefabs/Map/Kuni/" + subKuniId.ToString ();
             *      GameObject subKamonObj = Instantiate (Resources.Load (subKamonKuniPath)) as GameObject;
             *      subKamonObj.transform.SetParent (board.transform);
             *      subKamonObj.transform.localScale = new Vector2 (1, 0.8f);
             *      if (daimyoId != subDaimyoId) {
             *          string subImagePath = "Prefabs/Kamon/" + subDaimyoId.ToString ();
             *          subKamonObj.GetComponent<Image> ().sprite =
             *              Resources.Load (subImagePath, typeof(Sprite)) as Sprite;
             *
             *          //yukoudo
             *          int yukoudoValue = gaikou.getExistGaikouValue (daimyoId, subDaimyoId);
             *          string syukoudoPath = "Prefabs/Map/cyouhou/YukoudoLabel";
             *          GameObject yukoudoObj = Instantiate (Resources.Load (syukoudoPath)) as GameObject;
             *          yukoudoObj.transform.SetParent (subKamonObj.transform);
             *          yukoudoObj.GetComponent<Text> ().text = yukoudoValue.ToString ();
             *          yukoudoObj.transform.localScale = new Vector2 (0.08f, 0.1f);
             *          yukoudoObj.transform.localPosition = new Vector2 (0, 26);
             *
             *      } else {
             *          subKamonObj.GetComponent<Image> ().sprite =
             *              Resources.Load (imagePath, typeof(Sprite)) as Sprite;
             *      }
             *      subKamonObj.GetComponent<Button> ().enabled = false;
             *
             *      //Kamon adjustment
             *      int subBaseX = kuni.getKuniLocationX (subKuniId);
             *      int subBaseY = kuni.getKuniLocationY (subKuniId);
             *      int subAdjstX = subBaseX - baseX;
             *      int subAdjstY = subBaseY - baseY;
             *
             *      RectTransform subMapRect = subKamonObj.GetComponent<RectTransform> ();
             *      subMapRect.anchoredPosition3D = new Vector3 (subAdjstX, subAdjstY, 0);
             *
             *      if (targetKuniId != 0) {
             *          if (targetKuniId == subKuniId) {
             *              //kassen target
             *              Color atkColor = new Color (180f / 255f, 0f / 255f, 0f / 255f, 255f / 255f);
             *              subKamonObj.GetComponent<Image> ().color = atkColor;
             *          }
             *      }
             *
             *      if (snbRank > 1) {
             *          if (targetGaikouKuniId != 0) {
             *              if (targetGaikouKuniId == subKuniId) {
             *                  if (!sameDaimyoFlg) {
             *                      //gaikou target
             *                      Color gaikouColor = new Color (80f / 255f, 100f / 255f, 185f / 255f, 255f / 255f);
             *                      subKamonObj.GetComponent<Image> ().color = gaikouColor;
             *                  }
             *              }
             *          }
             *      }
             *  } else {
             *      Color noSubKuniColor = new Color (255f / 255f, 255f / 255f, 255f / 255f, 40f / 255f);
             *      subMap.GetComponent<Image> ().color = noSubKuniColor;
             *  }
             *
             * }
             *
             */
        }
    }
Esempio n. 26
0
    //doramatic charactor
    // Use this for initialization
    void Start()
    {
        //map生成
        Instantiate(mapPrefab);
        Instantiate(treePrefab);
        Instantiate(wallPrefab);

        /*プレイヤー配置*/

        //ユーザ陣形データのロード
        int jinkei =PlayerPrefs.GetInt("jinkei",0);

        //1.魚麟
        if (jinkei == 1) {
            if(PlayerPrefs.HasKey("1map1")){
                int mapId = 1;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }

            if(PlayerPrefs.HasKey("1map2")){
                int mapId = 2;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map7")){
                int mapId = 7;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map8")){
                 int mapId = 8;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);

            }
            if(PlayerPrefs.HasKey("1map11")){
                int mapId = 11;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map12")){
                int mapId = 12;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map13")){
                int mapId = 13;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map14")){
                int mapId = 14;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map17")){
                int mapId = 17;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map18")){
                int mapId = 18;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map21")){
                int mapId = 21;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("1map22")){
                int mapId = 22;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }

        //2.鶴翼
        }else if(jinkei == 2){
            if(PlayerPrefs.HasKey("2map3")){
                int mapId = 3;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map4")){
                int mapId = 4;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map5")){
                int mapId = 5;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map7")){
                int mapId = 7;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map8")){
                int mapId = 8;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map11")){
                int mapId = 11;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map12")){
                int mapId = 12;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map17")){
                int mapId = 17;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map18")){
                int mapId = 18;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map23")){
                int mapId = 23;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map24")){
                int mapId = 24;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("2map25")){
                int mapId = 25;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }

        }
        //3.偃月
        else if(jinkei == 3){
            if(PlayerPrefs.HasKey("3map3")){
                int mapId = 3;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map7")){
                int mapId = 7;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map8")){
                int mapId = 8;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map9")){
                int mapId = 9;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map11")){
                int mapId = 11;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map12")){
                int mapId = 12;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map14")){
                int mapId = 14;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map15")){
                int mapId = 15;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map16")){
                int mapId = 16;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map20")){
                int mapId = 20;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map21")){
                int mapId = 21;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("3map25")){
                int mapId = 25;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
        }

        //4.雁行
        else if(jinkei == 4){
            if(PlayerPrefs.HasKey("4map1")){
                int mapId = 1;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map2")){
                int mapId = 2;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map7")){
                int mapId = 7;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map8")){
                int mapId = 8;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map12")){
                int mapId = 12;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map13")){
                int mapId = 13;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map14")){
                int mapId = 14;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map18")){
                int mapId = 18;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map19")){
                int mapId = 19;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map20")){
                int mapId = 20;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map24")){
                int mapId = 24;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
            if(PlayerPrefs.HasKey("4map25")){
                int mapId = 25;
                String map = jinkei.ToString() + "map" + mapId;
                //Get Status
                int busyoInt = PlayerPrefs.GetInt(map);

                string busyoString = busyoInt.ToString();
                int lv =PlayerPrefs.GetInt(busyoString);

                StatusGet sts = new StatusGet();
                int hp = sts.getHp(busyoInt,lv);
                int atk = sts.getAtk(busyoInt,lv);
                int dfc = sts.getDfc(busyoInt,lv);
                int spd = sts.getSpd(busyoInt,lv);
                string busyoName = sts.getBusyoName(busyoInt);
                ArrayList senpouArray = sts.getSenpou(busyoInt);

                //View Object & pass status to it.
                PlayerInstance inst = new PlayerInstance();
                inst.makeInstance(busyoInt, mapId, hp, atk, dfc, spd, senpouArray, busyoName);
            }
        }

        /*エネミー配置*/
        //stageId取得しマスタ判別
        int tempStageId = PlayerPrefs.GetInt("activeStageId",0);
        int kuniId = PlayerPrefs.GetInt("activeKuniId",0);
        Entity_stage_mst stageMst  = Resources.Load ("Data/stage_mst") as Entity_stage_mst;

        //y=10(X-1)+z-1
        int stageId = 10*(kuniId - 1) + tempStageId;
        int enemyJinkei = stageMst.param[stageId - 1].jinkei;
        int enemyLv = stageMst.param[stageId - 1].lv;

        int[] enemyArray = new int[25];
        enemyArray[0] = stageMst.param[stageId - 1].map1;
        enemyArray[1] = stageMst.param[stageId - 1].map2;
        enemyArray[2] = stageMst.param[stageId - 1].map3;
        enemyArray[3] = stageMst.param[stageId - 1].map4;
        enemyArray[4] = stageMst.param[stageId - 1].map5;
        enemyArray[5] = stageMst.param[stageId - 1].map6;
        enemyArray[6] = stageMst.param[stageId - 1].map7;
        enemyArray[7] = stageMst.param[stageId - 1].map8;
        enemyArray[8] = stageMst.param[stageId - 1].map9;
        enemyArray[9] = stageMst.param[stageId - 1].map10;
        enemyArray[10] = stageMst.param[stageId - 1].map11;
        enemyArray[11] = stageMst.param[stageId - 1].map12;
        enemyArray[12] = stageMst.param[stageId - 1].map13;
        enemyArray[13] = stageMst.param[stageId - 1].map14;
        enemyArray[14] = stageMst.param[stageId - 1].map15;
        enemyArray[15] = stageMst.param[stageId - 1].map16;
        enemyArray[16] = stageMst.param[stageId - 1].map17;
        enemyArray[17] = stageMst.param[stageId - 1].map18;
        enemyArray[18] = stageMst.param[stageId - 1].map19;
        enemyArray[19] = stageMst.param[stageId - 1].map20;
        enemyArray[20] = stageMst.param[stageId - 1].map21;
        enemyArray[21] = stageMst.param[stageId - 1].map22;
        enemyArray[22] = stageMst.param[stageId - 1].map23;
        enemyArray[23] = stageMst.param[stageId - 1].map24;
        enemyArray[24] = stageMst.param[stageId - 1].map25;
        int ch_num = stageMst.param[stageId - 1].chQty;
        int ch_lv = stageMst.param[stageId - 1].lv;

        for(int i=0; i < enemyArray.Length; i++ ){
            if(enemyArray[i] != 0){
                int enemyMapId = i+1;
                int EnemyMap = enemyArray[i];
                StatusGet sts = new StatusGet();
                int hp = sts.getHp(EnemyMap,enemyLv);
                int atk = sts.getAtk(EnemyMap,enemyLv);
                int dfc = sts.getDfc(EnemyMap,enemyLv);
                int spd = sts.getSpd(EnemyMap,enemyLv);

                BusyoInfoGet info = new BusyoInfoGet();
                String busyoName = info.getName(EnemyMap);
                String ch_type = info.getHeisyu(EnemyMap);

                EnemyInstance inst = new EnemyInstance();
                inst.makeInstance(enemyMapId, EnemyMap, ch_lv, ch_type, ch_num, hp, atk, dfc, spd, busyoName);
            }
        }

        //HP bar
        //Instantiate(hpBarPlayerPrefab);
        //Instantiate(hpBarEnemyPrefab);

        //合戦開始エフェクト
        string pathBack = "Prefabs/PreKassen/backGround";
        GameObject back = Instantiate(Resources.Load (pathBack)) as GameObject;
        back.transform.localScale = new Vector2 (30, 15);

        string pathLight = "Prefabs/PreKassen/lightning";
        GameObject light = Instantiate(Resources.Load (pathLight)) as GameObject;
        light.transform.localScale = new Vector2 (10, 10);
    }
Esempio n. 27
0
    public void createBusyoView(string busyoId)
    {
        string     path  = "Prefabs/Player/Unit/BusyoUnit";
        GameObject Busyo = Instantiate(Resources.Load(path)) as GameObject;

        Busyo.name = busyoId;

        Busyo.transform.SetParent(GameObject.Find("BusyoView").transform);
        Busyo.transform.localScale = new Vector2(4, 4);

        RectTransform rect_transform = Busyo.GetComponent <RectTransform>();

        rect_transform.anchoredPosition3D = new Vector3(300, 200, 0);
        rect_transform.sizeDelta          = new Vector2(100, 100);

        Busyo.GetComponent <DragHandler> ().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, int.Parse(busyoId));

        ShipObj.transform.localPosition = new Vector3(-40, -40, 0);
        ShipObj.transform.localScale    = new Vector2(0.4f, 0.4f);
        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
        GameObject text = Busyo.transform.FindChild("Text").gameObject;

        text.GetComponent <Text> ().color = new Color(255, 255, 255, 255);
        RectTransform text_transform = text.GetComponent <RectTransform>();

        text_transform.anchoredPosition3D = new Vector3(-70, 30, 0);
        text_transform.sizeDelta          = new Vector2(630, 120);
        text.transform.localScale         = new Vector2(0.2f, 0.2f);

        //Keep busyo name
        BusyoInfoGet busyoScript = new BusyoInfoGet();
        string       busyoName   = busyoScript.getName(int.Parse(busyoId));

        GameObject.Find("GameScene").GetComponent <NowOnBusyo>().OnBusyoName = busyoName;

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

        rank_transform.anchoredPosition3D   = new Vector3(20, -50, 0);
        rank_transform.sizeDelta            = new Vector2(200, 200);
        rank.GetComponent <Text>().fontSize = 200;
    }
Esempio n. 28
0
	public void kuniScrollView(GameObject baseObj,  string targetDaimyo, GameObject btn){
		
		GameObject content = baseObj.transform.FindChild("scroll").transform.FindChild("Content").gameObject;

		string seiryoku = PlayerPrefs.GetString ("seiryoku");
		char[] delimiterChars = {','};
		List<string> seiryokuList = new List<string>();
		seiryokuList = new List<string> (seiryoku.Split (delimiterChars));

		//my kuni
		int myDaimyo = PlayerPrefs.GetInt ("myDaimyo");
		string myKuni = PlayerPrefs.GetString ("clearedKuni"); 
		List<int> myKuniList = new List<int>();
		if (myKuni.Contains (",")) {
			List<string> tempMyKuniList = new List<string> (myKuni.Split (delimiterChars));
			myKuniList = tempMyKuniList.ConvertAll(x => int.Parse(x));
		} else {
			myKuniList.Add(int.Parse(myKuni));
		}

		//doumei daimyo's opne kuni
		KuniInfo kuni = new KuniInfo ();
		List<int> doumeiOpenKuniList = new List<int>();
		List<int> doumeiKuniList = new List<int>();
		for(int i=0; i<seiryokuList.Count; i++){
			string tempDaimyo = seiryokuList[i];
			if(tempDaimyo == targetDaimyo){
				int doumeiKuniId = i + 1;
				doumeiKuniList.Add(doumeiKuniId);
				doumeiOpenKuniList.AddRange(kuni.getMappingKuni(doumeiKuniId));
			}
		}

		//"doumei daimyo's opne kuni" minus "my kuni"  
		List<int> doumeiOpenKuniMinusMyKuniList = new List<int>();
		foreach(int n in doumeiOpenKuniList){

			if(!myKuniList.Contains(n)){
				doumeiOpenKuniMinusMyKuniList.Add(n);
			}
		}

		//"doumei daimyo's doumei check
		string tempDoumei = "doumei" + targetDaimyo;
		string doumei = PlayerPrefs.GetString (tempDoumei);
		List<string> doumeiList = new List<string>();
		if (doumei.Contains (",")) {
			doumeiList = new List<string> (doumei.Split (delimiterChars));
		} else {
			doumeiList.Add(doumei);
		}

		if (doumei != null && doumei != "") {
			for(int t=0; t<doumeiOpenKuniMinusMyKuniList.Count; t++){
			//foreach (int n in doumeiOpenKuniMinusMyKuniList) {
				string checkDaimyoId = seiryokuList [doumeiOpenKuniMinusMyKuniList[t] - 1];
				if (doumeiList.Contains (checkDaimyoId)) {
					doumeiOpenKuniMinusMyKuniList.Remove (doumeiOpenKuniMinusMyKuniList[t]);
				}
			}
		}



		//Compare "doumei open" with "my open"
		string myOpenKuni = PlayerPrefs.GetString ("openKuni"); 
		List<int> myOpenKuniList = new List<int>();
		if (myOpenKuni.Contains (",")) {
			List<string> tempMyOpenKuniList = new List<string> (myOpenKuni.Split (delimiterChars));
			myOpenKuniList = tempMyOpenKuniList.ConvertAll(x => int.Parse(x));
		} else {
			myOpenKuniList.Add(int.Parse(myOpenKuni));
		}

		List<int> sameTargetKuniList = new List<int>();
		foreach(int n in myOpenKuniList){
			if(doumeiOpenKuniMinusMyKuniList.Contains(n)){
				if(!doumeiKuniList.Contains(n)){
					if(!sameTargetKuniList.Contains(n)){
						sameTargetKuniList.Add(n);
					}
				}
			}
		}


		/*Slot making*/
		string temp = "gaikou" + targetDaimyo;
		int myYukoudo = PlayerPrefs.GetInt(temp);

		//Get Chiryaku
		Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst;
		int myDaimyoBusyoId = daimyoMst.param [myDaimyo - 1].busyoId;
		BusyoInfoGet busyo = new BusyoInfoGet ();
		int chiryaku = busyo.getMaxDfc (myDaimyoBusyoId);
		//StatusGet sts = new StatusGet();
		//int lv = PlayerPrefs.GetInt (myDaimyoBusyoId.ToString());
		//float chiryaku = (float)sts.getDfc(myDaimyoBusyoId,lv);
		//chiryaku = chiryaku *10;


		string slotPath = "Prefabs/Map/common/kuniSlot";
		for (int i=0; i<sameTargetKuniList.Count; i++) {
			GameObject prefab = Instantiate (Resources.Load (slotPath)) as GameObject;
			prefab.transform.SetParent(content.transform);
			prefab.transform.localScale = new Vector3 (1, 1, 1);

			int kuniId = sameTargetKuniList[i];
			int daimyoId = int.Parse (seiryokuList [kuniId - 1]);
			string daimyoName = daimyoMst.param [daimyoId - 1].daimyoName;

			string theirYukouTemp = "";
			if(int.Parse(targetDaimyo) < daimyoId){
				theirYukouTemp = targetDaimyo + "gaikou" + daimyoId.ToString();
			}else{
				theirYukouTemp = daimyoId.ToString() + "gaikou" + targetDaimyo;
			}

			int theirYukoudo = PlayerPrefs.GetInt(theirYukouTemp);

			string kuniName = kuni.getKuniName(kuniId);
			prefab.transform.FindChild("KuniValue").GetComponent<Text>().text = kuniName;
			prefab.transform.FindChild("DaimyoValue").GetComponent<Text>().text = daimyoName;
			prefab.GetComponent<GaikouKuniSelect>().Content = content;
			prefab.GetComponent<GaikouKuniSelect>().Btn = btn;

			prefab.GetComponent<GaikouKuniSelect>().myYukoudo = myYukoudo;
			prefab.GetComponent<GaikouKuniSelect>().chiryaku = chiryaku;
			prefab.GetComponent<GaikouKuniSelect>().kuniDiff = kuniDiff;
			prefab.GetComponent<GaikouKuniSelect>().theirYukoudo = theirYukoudo;
			prefab.GetComponent<GaikouKuniSelect>().kuniName = kuniName;
			prefab.GetComponent<GaikouKuniSelect>().targetKuniId = kuniId;

			if(i == 0){
				prefab.GetComponent<GaikouKuniSelect>().OnClick();
			}
		}

		if (sameTargetKuniList.Count == 0) {
			string msgPath = "Prefabs/Map/gaikou/NoKyoutouMsg";
			GameObject msg = Instantiate (Resources.Load (msgPath)) as GameObject;
			msg.transform.SetParent(GameObject.Find("scroll").transform);
			msg.transform.localScale = new Vector3 (0.17f, 0.2f, 1);
			RectTransform msgTransform = msg.GetComponent<RectTransform> ();
			msgTransform.anchoredPosition = new Vector3 (-260, -115, 0);

			GameObject a = baseObj.transform.FindChild ("RequiredMoney").gameObject;
			GameObject b = baseObj.transform.FindChild ("KyoutouRatio").gameObject;
			Destroy(a);
			Destroy(b);

			btn.GetComponent<Button>().enabled = false;
			
		}

		
	}
Esempio n. 29
0
    public void receiveBusyo(int busyoId)
    {
        //Common
        BusyoInfoGet BusyoInfoGet = new BusyoInfoGet();
        string       busyoName    = BusyoInfoGet.getName(busyoId);
        string       heisyu       = BusyoInfoGet.getHeisyu(busyoId);
        string       rank         = BusyoInfoGet.getRank(busyoId);
        int          myBusyoQty   = PlayerPrefs.GetInt("myBusyoQty");

        //Tracking
        int TrackNewBusyoHireNo = PlayerPrefs.GetInt("TrackNewBusyoHireNo", 0);

        TrackNewBusyoHireNo = TrackNewBusyoHireNo + 1;
        PlayerPrefs.SetInt("TrackNewBusyoHireNo", TrackNewBusyoHireNo);

        //Add zukan & gacya History Start
        string zukanBusyoHst = PlayerPrefs.GetString("zukanBusyoHst");

        if (zukanBusyoHst != null && zukanBusyoHst != "")
        {
            zukanBusyoHst = zukanBusyoHst + "," + busyoId.ToString();
        }
        else
        {
            zukanBusyoHst = busyoId.ToString();
        }
        PlayerPrefs.SetString("zukanBusyoHst", zukanBusyoHst);

        //Daimyo Busyo History
        Daimyo daimyo = new Daimyo();

        if (daimyo.daimyoBusyoCheck(busyoId))
        {
            string gacyaDaimyoHst = PlayerPrefs.GetString("gacyaDaimyoHst");
            if (gacyaDaimyoHst != null && gacyaDaimyoHst != "")
            {
                gacyaDaimyoHst = gacyaDaimyoHst + "," + busyoId.ToString();
            }
            else
            {
                gacyaDaimyoHst = busyoId.ToString();
            }
            PlayerPrefs.SetString("gacyaDaimyoHst", gacyaDaimyoHst);
        }

        //My Busyo Exist Check
        string myBusyoString = PlayerPrefs.GetString("myBusyo");

        char[]        delimiterChars = { ',' };
        List <string> myBusyoList    = new List <string>();

        char[] delimiterChars2 = { ',' };
        if (myBusyoString.Contains(","))
        {
            myBusyoList = new List <string>(myBusyoString.Split(delimiterChars));
        }
        else
        {
            myBusyoList.Add(myBusyoString);
        }

        if (myBusyoList.Contains(busyoId.ToString()))
        {
            //add lv
            string addLvTmp   = "addlv" + busyoId.ToString();
            int    addLvValue = 0;
            if (PlayerPrefs.HasKey(addLvTmp))
            {
                addLvValue = PlayerPrefs.GetInt(addLvTmp);
                addLvValue = addLvValue + 1;
                if (addLvValue >= 100)
                {
                    addLvValue = 100;
                }
            }
            else
            {
                addLvValue = 1;
            }

            if (addLvValue < 100)
            {
                PlayerPrefs.SetInt(addLvTmp, addLvValue);
                PlayerPrefs.Flush();

                MessageBusyo msg     = new MessageBusyo();
                string       type    = "touyou";
                string       msgText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msgText = "Max Lv of " + busyoName + " increased.";
                }
                else
                {
                    msgText = busyoName + "の最大レベルが1上がりました。";
                }
                msg.makeMessage(msgText, busyoId, type);
            }
            else
            {
                //Lv up
                int currentLv = PlayerPrefs.GetInt(busyoId.ToString());
                int maxLv     = 100 + addLvValue;

                int    newLv    = 0;
                string lvUpText = "";

                //Already Lv Max
                if (currentLv == maxLv)
                {
                    newLv = currentLv;
                    int busyoDama = 0;
                    if (rank == "S")
                    {
                        busyoDama = 200;
                    }
                    else if (rank == "A")
                    {
                        busyoDama = 50;
                    }
                    else if (rank == "B")
                    {
                        busyoDama = 20;
                    }
                    else if (rank == "C")
                    {
                        busyoDama = 10;
                    }
                    int myBusyoDama = PlayerPrefs.GetInt("busyoDama");
                    myBusyoDama = myBusyoDama + busyoDama;
                    PlayerPrefs.SetInt("busyoDama", myBusyoDama);
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        lvUpText = "You got " + busyoDama + " stone.";
                    }
                    else
                    {
                        lvUpText = "武将珠" + busyoDama + "個を贈呈します。";
                    }
                }
                PlayerPrefs.SetInt(busyoId.ToString(), newLv);

                if (currentLv != maxLv)
                {
                    string exp      = "exp" + busyoId.ToString();
                    Exp    expCalc  = new Exp();
                    int    totalExp = expCalc.getExpforNextLv(currentLv);
                    PlayerPrefs.SetInt(exp, totalExp);
                }

                MessageBusyo msg  = new MessageBusyo();
                string       type = "touyou";
                msg.makeMessage(lvUpText, busyoId, type);
            }
        }
        else
        {
            int existCheck = PlayerPrefs.GetInt(busyoId.ToString());
            if (existCheck != 0 && existCheck != null)
            {
                //my Busyo not contain but player used him before daimyo was changed
                if (myBusyoString == null || myBusyoString == "")
                {
                    myBusyoString = busyoId.ToString();
                }
                else
                {
                    myBusyoString = myBusyoString + "," + busyoId.ToString();
                }
                PlayerPrefs.SetString("myBusyo", myBusyoString);

                //Add Qty
                myBusyoQty = myBusyoQty + 1;
                PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);

                MessageBusyo msg         = new MessageBusyo();
                string       touyouuText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    touyouuText = "We hired " + busyoName + ".";
                }
                else
                {
                    touyouuText = busyoName + "を登用しました。";
                }
                string type = "touyou";
                msg.makeMessage(touyouuText, busyoId, type);
            }
            else
            {
                //Add Completely New Data
                if (myBusyoString == null || myBusyoString == "")
                {
                    myBusyoString = busyoId.ToString();
                }
                else
                {
                    myBusyoString = myBusyoString + "," + busyoId.ToString();
                }
                PlayerPrefs.SetString("myBusyo", myBusyoString);
                PlayerPrefs.SetInt(busyoId.ToString(), 1);

                string hei      = "hei" + busyoId.ToString();
                string heiValue = heisyu + ":1:1:1";
                PlayerPrefs.SetString(hei, heiValue);

                string senpou = "senpou" + busyoId.ToString();
                PlayerPrefs.SetInt(senpou, 1); //Lv

                string saku = "saku" + busyoId.ToString();
                PlayerPrefs.SetInt(saku, 1); //Lv

                string kahou = "kahou" + busyoId.ToString();
                PlayerPrefs.SetString(kahou, "0,0,0,0,0,0,0,0");

                string exp = "exp" + busyoId.ToString();
                PlayerPrefs.SetInt(exp, 0);

                //Add Qty
                myBusyoQty = myBusyoQty + 1;
                PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);

                //View Message Box
                Destroy(GameObject.Find("board(Clone)"));
                Destroy(GameObject.Find("Back(Clone)"));

                MessageBusyo msg         = new MessageBusyo();
                string       touyouuText = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    touyouuText = "We hired " + busyoName + ".";
                }
                else
                {
                    touyouuText = busyoName + "を登用しました。";
                }
                string type = "touyou";
                msg.makeMessage(touyouuText, busyoId, type);
            }
        }
    }
Esempio n. 30
0
	// Use this for initialization
	public void Start () {
		

		Resources.UnloadUnusedAssets ();

		//Data Initialization
		//DataMaker data = new DataMaker ();
		//data.Start ();

		/*Initial Data*/
		bool initDataFlg = PlayerPrefs.GetBool ("initDataFlg");
		if (initDataFlg == false) {
			//my daimyo
			InitDataMaker initData = new InitDataMaker ();
			initData.makeInitData ();
		}

		/*--------------------*/
		/*Game Over*/
		/*--------------------*/
		bool gameOverFlg = PlayerPrefs.GetBool("gameOverFlg");
		if (gameOverFlg) {
		
			Application.LoadLevel ("clearOrGameOver");	
		
		} else {
		
			/*--------------------*/
			/*Game Clear*/
			/*--------------------*/
			bool gameClearFlg = PlayerPrefs.GetBool ("gameClearFlg");

			if (gameClearFlg) {
				Application.LoadLevel ("clearOrGameOver");
			
			} else {

				Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst;
				Entity_kuni_mapping_mst kuniMappingMst = Resources.Load ("Data/kuni_mapping_mst") as Entity_kuni_mapping_mst;
				Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst;

				//Base Info.
				int kuniLv = PlayerPrefs.GetInt ("kuniLv");
				int money = PlayerPrefs.GetInt ("money");
				int busyoDama = PlayerPrefs.GetInt ("busyoDama");
				GameObject.Find ("KuniLvValue").GetComponent<Text> ().text = kuniLv.ToString ();
				GameObject.Find ("MoneyValue").GetComponent<Text> ().text = money.ToString ();
				GameObject.Find ("BusyoDamaValue").GetComponent<Text> ().text = busyoDama.ToString ();

				myDaimyo = PlayerPrefs.GetInt ("myDaimyo");
				string myDaimyoName = daimyoMst.param [myDaimyo - 1].daimyoName;

				GameObject.Find ("DaimyoValue").GetComponent<Text> ().text = myDaimyoName;


				//Kuni List
				string openKuni = PlayerPrefs.GetString ("openKuni");

				List<string> openKuniList = new List<string> ();
				char[] delimiterChars = {','};
				if (openKuni != null && openKuni != "") {
					if (openKuni.Contains (",")) {
						openKuniList = new List<string> (openKuni.Split (delimiterChars));
					} else {
						openKuniList.Add (openKuni);
					}
				}

				GameObject kuniIconView = GameObject.Find ("KuniIconView");

				string clearedKuni = PlayerPrefs.GetString ("clearedKuni");

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

				/*View Every Kuni by Master*/
				GameObject KuniMap = GameObject.Find ("KuniMap");

				//Seiryoku Default Setting
				string seiryoku = PlayerPrefs.GetString ("seiryoku");
				List<string> seiryokuList = new List<string> ();
				seiryokuList = new List<string> (seiryoku.Split (delimiterChars));

				//Count my Kuni QTY
				for (int m=0; m<seiryokuList.Count; m++) {
					int seiryokuId = int.Parse (seiryokuList [m]);
					if (seiryokuId == myDaimyo) {
						myKuniQty = myKuniQty + 1;
					}
				}

				//My Doumei
				Color doumeiColor = new Color (100f / 255f, 130f / 255f, 255f / 255f, 255f / 255f); //Blue
				string myDoumei = PlayerPrefs.GetString ("doumei");
				List<string> myDoumeiList = new List<string> ();
				if (myDoumei != null && myDoumei != "") {
					if (myDoumei.Contains (",")) {
						myDoumeiList = new List<string> (myDoumei.Split (delimiterChars));
					} else {
						myDoumeiList.Add (myDoumei);
					}
				}

				string kuniPath = "Prefabs/Map/Kuni/";
				for (int i=0; i<kuniMst.param.Count; i++) {
					int kuniId = kuniMst.param [i].kunId;

					string newKuniPath = kuniPath + kuniId.ToString ();
					int locationX = kuniMst.param [i].locationX;
					int locationY = kuniMst.param [i].locationY;

					GameObject kuni = Instantiate (Resources.Load (newKuniPath)) as GameObject;

					kuni.transform.SetParent (kuniIconView.transform);
					kuni.name = kuniId.ToString ();
					kuni.GetComponent<SendParam> ().kuniId = kuniId;
					kuni.GetComponent<SendParam> ().kuniName = kuniMst.param [i].kuniName;
					kuni.transform.localScale = new Vector2 (1, 1);
					kuni.GetComponent<SendParam> ().naiseiItem = kuniMst.param [i].naisei;

					//Seiryoku Handling
					int daimyoId = int.Parse (seiryokuList [kuniId - 1]);

					string daimyoName = daimyoMst.param [daimyoId - 1].daimyoName;

					kuni.GetComponent<SendParam> ().daimyoId = daimyoId;
					kuni.GetComponent<SendParam> ().daimyoName = daimyoName;
					int daimyoBusyoIdTemp = daimyoMst.param [daimyoId - 1].busyoId;

					kuni.GetComponent<SendParam> ().daimyoBusyoId = daimyoBusyoIdTemp;
					BusyoInfoGet busyo = new BusyoInfoGet ();
					if (daimyoBusyoIdTemp != 0) {
						kuni.GetComponent<SendParam> ().daimyoBusyoAtk = busyo.getMaxAtk (daimyoBusyoIdTemp);
						kuni.GetComponent<SendParam> ().daimyoBusyoDfc = busyo.getMaxDfc (daimyoBusyoIdTemp);
					}

					//Senryoku
					//Count QTY of Enemy Kuni
					int enemyKuniQty = 1;
					//for (int l=0; l<seiryokuList.Count; l++) {
					//	int seiryokuId = int.Parse (seiryokuList [l]);
					//
					//	if (seiryokuId == daimyoId) {
					//		enemyKuniQty = enemyKuniQty + 1;
					//	}
					//}

					List<string> checkedKuniList = new List<string> ();
					enemyKuniQty = countLinkedKuniQty(1, kuniId, daimyoId, seiryokuList, checkedKuniList);

					EnemySenryokuCalc calc = new EnemySenryokuCalc ();
					int busyoQty = 0;
					int busyoLv = 0;
					int butaiQty = 0;
					int butaiLv = 0;

					busyoQty = calc.EnemyBusyoQtyCalc (myKuniQty, enemyKuniQty);
					if (busyoQty > 12) {
						busyoQty = 12;
					}
					int senryokuRatio = daimyoMst.param [daimyoId - 1].senryoku;
					busyoLv = calc.EnemyBusyoLvCalc (senryokuRatio);
					butaiQty = calc.EnemyButaiQtyCalc (enemyKuniQty);
					butaiLv = calc.EnemyButaiLvCalc (senryokuRatio);
					
					kuni.GetComponent<SendParam> ().busyoQty = busyoQty;
					kuni.GetComponent<SendParam> ().busyoLv = busyoLv;
					kuni.GetComponent<SendParam> ().butaiQty = butaiQty;
					kuni.GetComponent<SendParam> ().butaiLv = butaiLv;
					kuni.GetComponent<SendParam> ().kuniQty = enemyKuniQty;

					//Color Handling
					float colorR = (float)daimyoMst.param [daimyoId - 1].colorR;
					float colorG = (float)daimyoMst.param [daimyoId - 1].colorG;
					float colorB = (float)daimyoMst.param [daimyoId - 1].colorB;
					Color kuniColor = new Color (colorR / 255f, colorG / 255f, colorB / 255f, 255f / 255f);
					
					KuniMap.transform.FindChild (kuni.name).GetComponent<Image> ().color = kuniColor;

					//Daimyo Kamon Image
					string imagePath = "Prefabs/Kamon/" + daimyoId.ToString ();
					kuni.GetComponent<Image> ().sprite = 
						Resources.Load (imagePath, typeof(Sprite)) as Sprite;

					RectTransform kuniTransform = kuni.GetComponent<RectTransform> ();
					kuniTransform.anchoredPosition = new Vector3 (locationX, locationY, 0);

					//My Doumei Check
					if (myDoumei != null && myDoumei != "") {
						if (myDoumeiList.Contains (daimyoId.ToString ())) {
							kuni.GetComponent<SendParam> ().doumeiFlg = true;
							kuni.GetComponent<Image> ().color = doumeiColor;
						}
					}

					//My daimyo Check
					if (daimyoId == myDaimyo) {
						string myDaimyoPath = "Prefabs/Kamon/MyDaimyoKamon/" + myDaimyo.ToString ();
						kuni.GetComponent<Image> ().sprite = 
						Resources.Load (myDaimyoPath, typeof(Sprite)) as Sprite;
						kuni.GetComponent<SendParam> ().clearFlg = true;

						int myHeiryoku = PlayerPrefs.GetInt ("jinkeiHeiryoku");
						kuni.GetComponent<SendParam> ().heiryoku = myHeiryoku;

					} else {
						//Not my daimyo
						//Yukoudo
						string gaikouTemp = "gaikou" + daimyoId;
						int myYukouValue = PlayerPrefs.GetInt (gaikouTemp);
						kuni.GetComponent<SendParam> ().myYukouValue = myYukouValue;


						if (daimyoBusyoIdTemp != 0) {
							StatusGet sts = new StatusGet ();
							int hp = sts.getHp (daimyoBusyoIdTemp, busyoLv);
							int hpResult = hp * 100 * busyoQty;
							string type = sts.getHeisyu (daimyoBusyoIdTemp);
							int chHp = sts.getChHp (type, butaiLv, hp);
							chHp = chHp * butaiQty * busyoQty * 10;

							int totalHei = hpResult + chHp;
							kuni.GetComponent<SendParam> ().heiryoku = totalHei;
						}

						//Action Policy Setting(agrresive false or true)
						if(enemyKuniQty>=3){
							kuni.GetComponent<SendParam> ().aggressiveFlg = getAggressiveFlg (0); // big country
						}else {
							kuni.GetComponent<SendParam> ().aggressiveFlg = getAggressiveFlg (1); // small country
						}

						//Cyouhou Flg
						string cyouhouTmp = "cyouhou" + kuniId;
						if (PlayerPrefs.HasKey (cyouhouTmp)) {
							int cyouhouSnbRankId = PlayerPrefs.GetInt (cyouhouTmp);
							kuni.GetComponent<SendParam> ().cyouhouSnbRankId = cyouhouSnbRankId;
						}

					}



				}

				//Color Change for kuni icon "Open but never cleared"
				Color openKuniColor = new Color (255f / 255f, 255f / 255f, 0f / 255f, 255f / 255f); //Yellow

				for (int i=0; i<openKuniList.Count; i++) {
					string openKuniId = openKuniList [i];

					//Flg Change
					GameObject targetOpenKuni = GameObject.Find ("KuniIconView").transform.FindChild (openKuniId).gameObject;
					targetOpenKuni.GetComponent<SendParam> ().openFlg = true;
					bool doumeiFlg = targetOpenKuni.GetComponent<SendParam> ().doumeiFlg;

					//Color Change
					if (!clearedKuniList.Contains (openKuniId)) {
						if (!doumeiFlg) {
							targetOpenKuni.GetComponent<Image> ().color = openKuniColor;
						}
					}
				}



				//Clear Kuni Check
				bool kuniClearedFlg = PlayerPrefs.GetBool ("kuniClearedFlg");
				if (kuniClearedFlg == true) {
					Message msg = new Message (); 
					string Text = "国盗り、祝着至極に御座りますな。\n民から武将珠100個届いておりますぞ。";
					msg.makeMessage (Text);

					//Add Busyo Dama
					busyoDama = busyoDama + 100;
					GameObject.Find ("BusyoDamaValue").GetComponent<Text> ().text = busyoDama.ToString ();

					PlayerPrefs.SetInt ("busyoDama", busyoDama);
					PlayerPrefs.SetBool ("kuniClearedFlg", false);
					PlayerPrefs.Flush ();
				}

				//From Naisei Check
				bool fromNaiseiFlg = PlayerPrefs.GetBool ("fromNaiseiFlg");
				if (fromNaiseiFlg == true) {
					int activeKuniId = PlayerPrefs.GetInt ("activeKuniId");
					GameObject.Find ("KuniIconView").transform.FindChild (activeKuniId.ToString ()).GetComponent<SendParam> ().OnClick ();
					GameObject.Find ("AttackButton").GetComponent<AttackNaiseiView> ().OnClick ();
					PlayerPrefs.SetBool ("fromNaiseiFlg", false);
					PlayerPrefs.Flush ();


				}

				/*Timer Handling*/
				//Last Log-In Time
				string timestring = PlayerPrefs.GetString ("lasttime");
				if (timestring == null || timestring == "")
					timestring = System.DateTime.Now.ToString ();
				System.DateTime datetime = System.DateTime.Parse (timestring);
				System.TimeSpan span = System.DateTime.Now - datetime;

				//経過時間を秒,時間で取得
				double spantime = span.TotalSeconds;



				//spantimeでスタミナの回復分を求める
				double staminaDouble = spantime / 300;
				int addHyourou = (int)staminaDouble;
				int amariSec = (int)spantime - (addHyourou * 300);
				amariSec = 300 - amariSec;

				//HyourouMax
				hyourouMax = PlayerPrefs.GetInt ("hyourouMax");
				GameObject.Find ("HyourouMaxValue").GetComponent<Text> ().text = hyourouMax.ToString ();

				//Now Hyourou
				int nowHyourou = PlayerPrefs.GetInt ("hyourou");
				currentHyourou = GameObject.Find ("HyourouCurrentValue").gameObject;
				currentHyourou.GetComponent<Text> ().text = nowHyourou.ToString ();


				//Hyourou Full Check
				if (hyourouMax <= nowHyourou) {
					hyourouFull = true;
					GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = hyourouMax.ToString ();
					PlayerPrefs.SetInt ("hyourou", hyourouMax);
					PlayerPrefs.Flush ();

				} else {

					if (addHyourou > 0) {
						int newHyourou = nowHyourou + addHyourou;

						if (hyourouMax <= newHyourou) {
							hyourouFull = true;
							PlayerPrefs.SetInt ("hyourou", hyourouMax);
							PlayerPrefs.Flush ();
							GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = hyourouMax.ToString ();

						} else {
							hyourouFull = false;
							PlayerPrefs.SetInt ("hyourou", newHyourou);
							PlayerPrefs.Flush ();
							GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = newHyourou.ToString ();

							//Timer
							GameObject.Find ("TimerValue").GetComponent<Text> ().text = amariSec.ToString ();
							timer = (float)amariSec;
						}

						//終了時の処理
						// 現在の時刻を取得
						System.DateTime now = System.DateTime.Now;
						// 文字列に変換して保存
						PlayerPrefs.SetString ("lasttime", now.ToString ());
						PlayerPrefs.Flush ();

					} else {
						hyourouFull = false;
						PlayerPrefs.SetInt ("hyourou", nowHyourou);
						PlayerPrefs.Flush ();
						GameObject.Find ("HyourouCurrentValue").GetComponent<Text> ().text = nowHyourou.ToString ();

						//Timer
						GameObject.Find ("TimerValue").GetComponent<Text> ().text = amariSec.ToString ();
						timer = (float)amariSec;
					}
				}


				/*Year & Season -Auto Count- Start*/
				string lastSeasonChangeTime = PlayerPrefs.GetString ("lastSeasonChangeTime");
				if (lastSeasonChangeTime == null || lastSeasonChangeTime == "") {
					lastSeasonChangeTime = System.DateTime.Now.ToString ();
					PlayerPrefs.SetString ("lastSeasonChangeTime", lastSeasonChangeTime);
					PlayerPrefs.Flush ();
				}
				System.DateTime SChangeTime = System.DateTime.Parse (lastSeasonChangeTime);
				System.TimeSpan scSpan = System.DateTime.Now - SChangeTime;
				double scSpanHour = scSpan.TotalHours;
				double scSpanSec = scSpan.TotalSeconds;

				string yearSeason = PlayerPrefs.GetString ("yearSeason");		
				string[] yearSeasonList = yearSeason.Split (delimiterChars);
				int nowYear = int.Parse (yearSeasonList [0]);
				int nowSeason = int.Parse (yearSeasonList [1]);
				if (scSpanHour >= 12) {
					int seasonPastCount = (int)scSpanHour / 12;


					int amari = (int)scSpanSec - (seasonPastCount * 43200);
					for (int i=1; i<=seasonPastCount; i++) {
						if (nowSeason == 4) {
							nowYear = nowYear + 1;
							nowSeason = 1;
						} else {
							nowSeason = nowSeason + 1;
						}
					}

					yearTimer = cyosyuMstTime - amari;

					string newYearSeason = nowYear.ToString () + "," + nowSeason.ToString ();
					PlayerPrefs.SetString ("yearSeason", newYearSeason);	

					lastSeasonChangeTime = System.DateTime.Now.ToString ();
					PlayerPrefs.SetString ("lastSeasonChangeTime", lastSeasonChangeTime);
					PlayerPrefs.SetBool ("doneCyosyuFlg", false);
					PlayerPrefs.SetString ("yearSeason", newYearSeason);
					PlayerPrefs.Flush ();

				} else {
					yearTimer = cyosyuMstTime - scSpanSec;
				}

				GameObject.Find ("YearValue").GetComponent<Text> ().text = nowYear.ToString ();
				SetSeason (nowSeason);


				doneCyosyuFlg = PlayerPrefs.GetBool ("doneCyosyuFlg");
				if (!doneCyosyuFlg) {
					GameObject.Find ("SeiryokuInfo").transform.FindChild ("Ex").GetComponent<Image> ().enabled = true;
				} else {
					GameObject.Find ("SeiryokuInfo").transform.FindChild ("Ex").GetComponent<Image> ().enabled = false;
				}

				/*Year & Season End*/


				/*--------------------*/
				/*Gunzei*/
				/*--------------------*/
				string keyHistory = PlayerPrefs.GetString ("keyHistory");
				List<string> keyHistoryList = new List<string> ();
				if (keyHistory != null && keyHistory != "") {
					if (keyHistory.Contains (",")) {
						keyHistoryList = new List<string> (keyHistory.Split (delimiterChars));
					} else {
						keyHistoryList.Add (keyHistory);
					}
				}

				for (int n=0; n<keyHistoryList.Count; n++) {
					string keyTemp = keyHistoryList [n];
					string keyValue = PlayerPrefs.GetString (keyTemp);
					if (keyValue != null) {
						List<string> keyValueList = new List<string> ();
						keyValueList = new List<string> (keyValue.Split (delimiterChars));

						string gunzeiTime = keyValueList [0];
						System.DateTime gunzeiDatetime = System.DateTime.Parse (gunzeiTime);
						System.TimeSpan gunzeiSpan = System.DateTime.Now - gunzeiDatetime;
						double gunzeiSpantime = gunzeiSpan.TotalSeconds;

						double remainTime = 0;
						List<string> srcDstKuniList = new List<string> ();
						char[] keyDelimiterChars = {'-'};
						srcDstKuniList = new List<string> (keyTemp.Split (keyDelimiterChars));
						int srcDaimyoId = int.Parse (keyValueList [1]);
						int dstDaimyoId = int.Parse (keyValueList [2]);
						int srcKuni = int.Parse (srcDstKuniList [0]);
						int dstKuni = int.Parse (srcDstKuniList [1]);
						bool dstEngunFlg = bool.Parse (keyValueList [9]);
						string dstEngunDaimyoId = keyValueList [10];
						string dstEngunHei = keyValueList [11];
						string dstEngunSts = keyValueList [12];

						if (gunzeiSpantime >= 300) {
							//Has past
							//Simulation
							Gunzei gunzei = new Gunzei ();

							if (dstDaimyoId != myDaimyo) {

								int enemyHei = gunzei.heiryokuCalc (int.Parse (srcDstKuniList [1]));

								int engunTotalHei = 0;
								if (dstEngunFlg) {
									char[] delimiterChars2 = {':'};
									List<string> engunHeiList = new List<string> ();
									engunHeiList = new List<string> (dstEngunHei.Split (delimiterChars2));
									
									for (int k=0; k<engunHeiList.Count; k++) {
										engunTotalHei = engunTotalHei + int.Parse (engunHeiList [k]);
									}
								}
								
								enemyHei = enemyHei + engunTotalHei;

								int ratio = 0;
								int myHei = int.Parse (keyValueList [5]);
								if ((myHei + enemyHei) > 0) {
									ratio = 100 * myHei / (myHei + enemyHei);
									if (ratio < 1) {
										ratio = 1;
									}
								}

								MainEventHandler kassenEvent = new MainEventHandler ();
								bool winFlg = kassenEvent.CheckByProbability (ratio);

								if (winFlg) {
									bool noGunzeiFlg = true;
									gunzei.win (keyTemp, int.Parse (keyValueList [1]), int.Parse (keyValueList [2]), noGunzeiFlg);
									
								} else {
									deleteKeyHistory (keyTemp);
								}
							} else {
								MyDaimyoWasAttacked atked = new MyDaimyoWasAttacked ();
								atked.wasAttacked (keyTemp, srcKuni, dstKuni, srcDaimyoId, dstDaimyoId, dstEngunFlg, dstEngunDaimyoId, dstEngunSts);

							}

						} else {

							//View Previous
							string path = "Prefabs/Map/Gunzei";
							GameObject Gunzei = Instantiate (Resources.Load (path)) as GameObject;			
							Gunzei.transform.SetParent (GameObject.Find ("Panel").transform);

							Gunzei.GetComponent<Gunzei> ().key = keyTemp;

							Gunzei.GetComponent<Gunzei> ().srcKuni = int.Parse (srcDstKuniList [0]);
							Gunzei.GetComponent<Gunzei> ().dstKuni = int.Parse (srcDstKuniList [1]);
							Gunzei.GetComponent<Gunzei> ().spantime = gunzeiSpantime;
							Gunzei.GetComponent<Gunzei> ().srcDaimyoId = srcDaimyoId;
							Gunzei.GetComponent<Gunzei> ().dstDaimyoId = dstDaimyoId;
							Gunzei.GetComponent<Gunzei> ().srcDaimyoName = keyValueList [3];
							Gunzei.GetComponent<Gunzei> ().dstDaimyoName = keyValueList [4];
							Gunzei.GetComponent<Gunzei> ().myHei = int.Parse (keyValueList [5]);
							Gunzei.GetComponent<Gunzei> ().dstEngunFlg = bool.Parse (keyValueList [9]);
							Gunzei.GetComponent<Gunzei> ().dstEngunDaimyoId = keyValueList [10];
							Gunzei.GetComponent<Gunzei> ().dstEngunHei = keyValueList [11];
							Gunzei.GetComponent<Gunzei> ().dstEngunSts = keyValueList [12];
							Gunzei.name = keyTemp;

							RectTransform GunzeiTransform = Gunzei.GetComponent<RectTransform> ();
							GunzeiTransform.anchoredPosition = new Vector3 (int.Parse (keyValueList [6]), int.Parse (keyValueList [7]), 0);

							if (keyValueList [8] == "right") {
								Gunzei.transform.localScale = new Vector2 (1, 1);
							} else {
								Gunzei.transform.localScale = new Vector2 (-1, 1);
								Gunzei.GetComponent<Gunzei> ().leftFlg = true;
							}
						}
					} else {
						PlayerPrefs.DeleteKey (keyTemp);
						PlayerPrefs.Flush ();
					
					}
				}

				//Metsubou Flg Check
				if (PlayerPrefs.HasKey ("metsubou")) {
					string metsubou = PlayerPrefs.GetString ("metsubou");
					List<string> metsubouList = new List<string> ();
					if (metsubou.Contains (",")) {
						metsubouList = new List<string> (metsubou.Split (delimiterChars));
					} else {
						metsubouList.Add (metsubou);
					}
					
					//Metsubou Message
					string pathOfBack = "Prefabs/Common/TouchBack";
					GameObject back = Instantiate (Resources.Load (pathOfBack)) as GameObject;
					back.transform.SetParent (GameObject.Find ("Panel").transform);
					back.transform.localScale = new Vector2 (1, 1);
					back.transform.localPosition = new Vector2 (0, 0);
					
					//make board
					string pathOfBoard = "Prefabs/Event/EventBoard";
					GameObject board = Instantiate (Resources.Load (pathOfBoard)) as GameObject;
					board.transform.SetParent (GameObject.Find ("Panel").transform);
					board.transform.localScale = new Vector2 (1, 1);
					
					string pathOfScroll = "Prefabs/Event/Metsubou";
					GameObject scroll = Instantiate (Resources.Load (pathOfScroll)) as GameObject;
					scroll.transform.SetParent (board.transform);
					scroll.transform.localScale = new Vector2 (1, 1);

					string pathOfSlot = "Prefabs/Event/MetsubouSlot";
					GameObject contents = scroll.transform.FindChild ("MetsubouScrollView/MetsubouContent").gameObject;
					char[] delimiterChars2 = {':'};
					foreach (string text in metsubouList) {
						GameObject slot = Instantiate (Resources.Load (pathOfSlot)) as GameObject;
						slot.transform.SetParent (contents.transform);
						List<string> metsubouTextList = new List<string> ();
						metsubouTextList = new List<string> (text.Split (delimiterChars2));
						string srcDaimyoName = daimyoMst.param [int.Parse (metsubouTextList [0]) - 1].daimyoName;
						string dstDaimyoName = daimyoMst.param [int.Parse (metsubouTextList [1]) - 1].daimyoName;
						string metsubouText = dstDaimyoName + "は" + srcDaimyoName + "に滅ぼされました";
						slot.transform.FindChild ("MetsubouText").GetComponent<Text> ().text = metsubouText;
						slot.transform.localScale = new Vector2 (1, 1);

						//Metsubou Daimyo Handling
						string srcMetsubouTemp = "metsubou" + metsubouTextList [0];
						string srcMetsubou = PlayerPrefs.GetString (srcMetsubouTemp);
						string dstMetsubouTemp = "metsubou" + metsubouTextList [1];
						string dstMetsubou = PlayerPrefs.GetString (dstMetsubouTemp);

						string newSrcMetsubou = "";
						if (srcMetsubou != null && srcMetsubou != "") {
							newSrcMetsubou = srcMetsubou + "," + metsubouTextList [1];
						} else {
							newSrcMetsubou = metsubouTextList [1];
						}
						if (dstMetsubou != null && dstMetsubou != "") {
							newSrcMetsubou = newSrcMetsubou + "," + dstMetsubou;
						}
						PlayerPrefs.SetString (srcMetsubouTemp, newSrcMetsubou);

					}
					
					PlayerPrefs.DeleteKey ("metsubou");
					PlayerPrefs.Flush ();
				}


				/*--------------------*/
				/*Enemy Action*/
				/*--------------------*/
				MainEventHandler gameEvent = new MainEventHandler ();
				gameEvent.mainHandler ();
			}
		}
	}	
Esempio n. 31
0
	public void enemyEngunInstance(string enemyEngunList){
		
		List<string> daimyoEnguniList = new List<string> ();
		char[] delimiterChars = {':'};
		char[] delimiterChars2 = {'-'};
		if(enemyEngunList.Contains(":")){
			daimyoEnguniList = new List<string> (enemyEngunList.Split (delimiterChars));
		}else{
			daimyoEnguniList.Add(enemyEngunList);
		}
		
		for(int i=0; i<daimyoEnguniList.Count; i++){
			string daimyoEngunString = daimyoEnguniList[i];
			List<string> unitEnguniList = new List<string> ();
			unitEnguniList = new List<string> (daimyoEngunString.Split (delimiterChars2));
			int busyoId = int.Parse(unitEnguniList[0]);
			if(busyoId!=0){
				int busyoLv = int.Parse(unitEnguniList[1]);
				int butaiQty = int.Parse(unitEnguniList[2]);
				int butaiLv = int.Parse(unitEnguniList[3]);
				
				StatusGet sts = new StatusGet ();
				int hp = sts.getHp (busyoId, busyoLv);
				int atk = sts.getAtk (busyoId, busyoLv);
				int dfc = sts.getDfc (busyoId, busyoLv);
				int spd = sts.getSpd (busyoId, busyoLv);
				string busyoName = sts.getBusyoName (busyoId);
				ArrayList senpouArray = sts.getSenpou (busyoId);
				
				//View Object & pass status to it. 
				EnemyInstance inst = new EnemyInstance ();
				BusyoInfoGet info = new BusyoInfoGet ();
				string ch_type = info.getHeisyu (busyoId);
				int mapId = 22;

				inst.makeInstance(mapId, busyoId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false);
			}
		}
		Message msg = new Message ();
		string text = "敵軍の援軍が到着しましたぞ!";
		msg.makeKassenMessage (text);
		
		
	}
Esempio n. 32
0
    void Start()
    {
        DataReward DataReward = GameObject.Find("DataStore").GetComponent <DataReward>();
        GameObject content    = GameObject.Find("Content").gameObject;

        for (int i = 0; i < DataReward.itemTitleList.Count; i++)
        {
            string objectId = DataReward.objectIdList[i];
            string title    = DataReward.itemTitleList[i];
            string grp      = DataReward.itemGrpList[i];
            string rank     = DataReward.itemRankList[i];
            int    qty      = DataReward.itemQtyList[i];

            string     slotPath = "Prefabs/PvP/RewardSlot";
            GameObject slot     = Instantiate(Resources.Load(slotPath)) as GameObject;
            slot.transform.SetParent(content.transform);
            slot.transform.localScale = new Vector2(1, 1);

            //view
            slot.transform.FindChild("title").GetComponent <Text>().text = title;

            //hide other image
            GameObject    imageContent  = slot.transform.FindChild("ScrollView").transform.FindChild("Viewport").transform.FindChild("Content").gameObject;
            RewardReceive RewardReceive = slot.transform.FindChild("button").GetComponent <RewardReceive>();

            foreach (Transform obj in imageContent.transform)
            {
                if (obj.name != grp)
                {
                    Destroy(obj.gameObject);
                    slot.transform.FindChild("circle").transform.FindChild("Text").GetComponent <Text>().text  = grp;
                    slot.transform.FindChild("circle").transform.FindChild("Text").GetComponent <Text>().color = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
                }
                else
                {
                    if (grp == "money")
                    {
                        obj.transform.FindChild("qty").GetComponent <Text>().text = qty.ToString();
                    }
                    else if (grp == "stone")
                    {
                        obj.transform.FindChild("qty").GetComponent <Text>().text = qty.ToString();
                    }
                    else if (grp == "busyo")
                    {
                        obj.transform.FindChild("rank").GetComponent <Text>().text = rank;
                        BusyoInfoGet BusyoInfoGet = new BusyoInfoGet();
                        int          busyoId      = BusyoInfoGet.getRandomBusyoId(rank);
                        RewardReceive.busyoId = busyoId;
                    }
                    else if (grp == "kaho")
                    {
                        obj.transform.FindChild("qty").GetComponent <Text>().text  = "x " + qty.ToString();
                        obj.transform.FindChild("rank").GetComponent <Text>().text = rank;

                        //kahouType bugu,kabuto,gusoku,meiba,cyadougu,heihousyo,chishikisyo
                        for (int j = 0; j < qty; j++)
                        {
                            List <string> kahouuTypeList = new List <string>()
                            {
                                "bugu", "kabuto", "gusoku", "meiba", "cyadougu", "heihousyo", "chishikisyo"
                            };
                            int    rdmId   = UnityEngine.Random.Range(0, kahouuTypeList.Count);
                            string kahoTyp = kahouuTypeList[rdmId];

                            Kahou Kahou  = new Kahou();
                            int   kahoId = Kahou.getRamdomKahouId(kahoTyp, rank);
                            RewardReceive.kahoTypList.Add(kahoTyp);
                            RewardReceive.kahoIdList.Add(kahoId);
                            RewardReceive.kahoNameList.Add(Kahou.getKahouName(kahoTyp, kahoId));
                        }
                    }
                    else if (grp == "syokaijyo")
                    {
                        string rankTmp = "";
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            if (rank == "S")
                            {
                                rankTmp = "High";
                            }
                            else if (rank == "A")
                            {
                                rankTmp = "Mid";
                            }
                            else if (rank == "B")
                            {
                                rankTmp = "Low";
                            }
                        }
                        else
                        {
                            if (rank == "S")
                            {
                                rankTmp = "上";
                            }
                            else if (rank == "A")
                            {
                                rankTmp = "中";
                            }
                            else if (rank == "B")
                            {
                                rankTmp = "下";
                            }
                        }
                        obj.transform.FindChild("qty").GetComponent <Text>().text  = "x " + qty.ToString();
                        obj.transform.FindChild("rank").GetComponent <Text>().text = rankTmp;
                    }
                }
            }

            //Set Value
            RewardReceive.slot     = slot;
            RewardReceive.objectId = objectId;
            RewardReceive.grp      = grp;
            RewardReceive.qty      = qty;
            RewardReceive.rank     = rank;
        }
    }
Esempio n. 33
0
    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);
                }
            }
        }
    }
Esempio n. 34
0
    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");
        }
    }
Esempio n. 35
0
    public void enemyEngunInstance(string enemyEngunList, float mntMinusRatio, float seaMinusRatio, float rainMinusRatio, float snowMinusRatio)
    {
        List <string> daimyoEnguniList = new List <string> ();

        char[] delimiterChars  = { ':' };
        char[] delimiterChars2 = { '-' };
        if (enemyEngunList.Contains(":"))
        {
            daimyoEnguniList = new List <string> (enemyEngunList.Split(delimiterChars));
        }
        else
        {
            daimyoEnguniList.Add(enemyEngunList);
        }

        for (int i = 0; i < daimyoEnguniList.Count; i++)
        {
            StatusGet     sts = new StatusGet();
            string        daimyoEngunString = daimyoEnguniList[i];
            List <string> unitEnguniList    = new List <string> ();
            unitEnguniList = new List <string> (daimyoEngunString.Split(delimiterChars2));
            int    busyoId = int.Parse(unitEnguniList[1]);
            string heisyu  = sts.getHeisyu(busyoId);

            if (busyoId != 0)
            {
                int busyoLv  = int.Parse(unitEnguniList[2]);
                int butaiQty = int.Parse(unitEnguniList[3]);
                int butaiLv  = int.Parse(unitEnguniList[4]);

                int    hp        = sts.getHp(busyoId, busyoLv);
                int    atk       = sts.getAtk(busyoId, busyoLv);
                int    dfc       = sts.getDfc(busyoId, busyoLv);
                int    spd       = sts.getSpd(busyoId, busyoLv);
                string busyoName = sts.getBusyoName(busyoId);

                int aveSenpouLv = 0;
                if (Application.loadedLevelName != "kaisen")
                {
                    aveSenpouLv = GameObject.Find("GameScene").GetComponent <GameScene> ().aveSenpouLv;
                }
                else
                {
                    aveSenpouLv = GameObject.Find("GameScene").GetComponent <KaisenScene>().aveSenpouLv;
                }
                ArrayList senpouArray = sts.getEnemySenpou(busyoId, aveSenpouLv, "");


                if (mntMinusRatio != 0)
                {
                    if (heisyu == "KB")
                    {
                        float tmp = (float)spd * mntMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        spd = Mathf.FloorToInt(tmp);
                    }
                }
                else if (seaMinusRatio != 0)
                {
                    if (heisyu == "TP")
                    {
                        float tmp = (float)dfc * seaMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp = (float)dfc * seaMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp);
                    }
                }
                if (rainMinusRatio != 0)
                {
                    if (heisyu == "TP")
                    {
                        float tmp = (float)atk * rainMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        atk = Mathf.FloorToInt(tmp);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp = (float)atk * rainMinusRatio;
                        if (tmp < 1)
                        {
                            tmp = 1;
                        }
                        atk = Mathf.FloorToInt(tmp);
                    }
                }
                else if (snowMinusRatio != 0)
                {
                    float tmp = (float)spd * 0.5f;
                    if (tmp < 1)
                    {
                        tmp = 1;
                    }
                    spd = Mathf.FloorToInt(tmp);

                    if (heisyu == "TP")
                    {
                        float tmp2 = (float)atk * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        atk = Mathf.FloorToInt(tmp2);
                    }
                    else if (heisyu == "YM")
                    {
                        float tmp2 = (float)atk * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        atk = Mathf.FloorToInt(tmp2);
                    }
                    else if (heisyu == "KB")
                    {
                        float tmp2 = (float)dfc * snowMinusRatio;
                        if (tmp2 < 1)
                        {
                            tmp2 = 1;
                        }
                        dfc = Mathf.FloorToInt(tmp2);
                    }
                }

                //View Object & pass status to it.
                EnemyInstance inst    = new EnemyInstance();
                BusyoInfoGet  info    = new BusyoInfoGet();
                string        ch_type = info.getHeisyu(busyoId);
                int           mapId   = 22;

                if (Application.loadedLevelName != "kaisen")
                {
                    inst.makeInstance(mapId, busyoId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false, senpouArray, "");
                }
                else
                {
                    BusyoInfoGet busyoScript = new BusyoInfoGet();
                    int          shipId      = busyoScript.getShipId(busyoId);
                    inst.makeKaisenInstance(mapId, busyoId, shipId, butaiLv, ch_type, butaiQty, hp, atk, dfc, spd, busyoName, 0, false, senpouArray);
                }
            }
        }
        Message msg = new Message();

        msg.makeKassenMessage(msg.getMessage(131));
    }
Esempio n. 36
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;
            }
        }
    }
Esempio n. 37
0
	// Use this for initialization
	void Start () {


		//Dinamic Map
		activeKuniId  = PlayerPrefs.GetInt("activeKuniId");
		activeStageId = PlayerPrefs.GetInt("activeStageId");
		Stage stage = new Stage ();

		if (activeStageId != 0) {
			//Active

			int stageMapId = stage.getStageMap (activeKuniId, activeStageId); 

			string mapPath = "";
			string mapFrontPath = "";
			Instantiate (wallPrefab);

			if (stageMapId != 1) {
				if (stageMapId == 2) {
					//mountain
					mapPath = "Prefabs/PreKassen/map2";
					GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

					mapFrontPath = "Prefabs/PreKassen/mapFront2";
					GameObject mapFront = Instantiate (Resources.Load (mapFrontPath)) as GameObject;

					weatherHandling(stageMapId, map, mapFront);

				} else if (stageMapId == 3) {
					//sea
					mapPath = "Prefabs/PreKassen/map3";
					GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

					mapFrontPath = "Prefabs/PreKassen/mapFront3";
					GameObject mapFront = Instantiate (Resources.Load (mapFrontPath)) as GameObject;

					weatherHandling(stageMapId, map, mapFront);
				}
			} else {
				
				Instantiate (treePrefab);

				mapPath = "Prefabs/PreKassen/map1";
				GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

				weatherHandling(stageMapId, map, null);
			}

		} else {
			//Passive
			int stageMapId = stage.getStageMap (activeKuniId, 10); 

			string mapPath = "";
			string mapFrontPath = "";
			Instantiate (wallPrefab);

			if (stageMapId != 1) {
				if (stageMapId == 2) {
					//mountain
					mapPath = "Prefabs/PreKassen/map2";
					GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

					mapFrontPath = "Prefabs/PreKassen/mapFront2";
					GameObject mapFront = Instantiate (Resources.Load (mapFrontPath)) as GameObject;

					weatherHandling(stageMapId, map, mapFront);

				} else if (stageMapId == 3) {
					//sea
					mapPath = "Prefabs/PreKassen/map3";
					GameObject map = Instantiate (Resources.Load (mapPath)) as GameObject;

					mapFrontPath = "Prefabs/PreKassen/mapFront3";
					GameObject mapFront = Instantiate (Resources.Load (mapFrontPath)) as GameObject;

					weatherHandling(stageMapId, map, mapFront);
				}
			} else {
				Instantiate (mapPrefab);
				Instantiate (treePrefab);

				weatherHandling(stageMapId, mapPrefab, null);
			}
		}

		/*Get Minus Status*/
		float mntMinusRatio = PlayerPrefs.GetFloat("mntMinusStatus",0);
		float seaMinusRatio = PlayerPrefs.GetFloat("seaMinusStatus",0);
		float rainMinusRatio = PlayerPrefs.GetFloat("rainMinusStatus",0);
		float snowMinusRatio = PlayerPrefs.GetFloat("snowMinusStatus",0);
	
		/*プレイヤー配置*/
		//ユーザ陣形データのロード
		int jinkei =PlayerPrefs.GetInt("jinkei",0);
		List<int> myBusyoList = new List<int> (); 

		//1.魚麟
		if (jinkei == 1) {
			soudaisyo = PlayerPrefs.GetInt("soudaisyo1");
			if(PlayerPrefs.HasKey("1map1")){
				int mapId = 1;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map2")){
				int mapId = 2;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map7")){
				int mapId = 7;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map8")){
				int mapId = 8;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map11")){
				int mapId = 11;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map12")){
				int mapId = 12;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map13")){
				int mapId = 13;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map14")){
				int mapId = 14;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map17")){
				int mapId = 17;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map18")){
				int mapId = 18;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map21")){
				int mapId = 21;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("1map22")){
				int mapId = 22;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}



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

			if(PlayerPrefs.HasKey("2map3")){
				int mapId = 3;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map4")){
				int mapId = 4;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map5")){
				int mapId = 5;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map7")){
				int mapId = 7;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map8")){
				int mapId = 8;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map11")){
				int mapId = 11;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map12")){
				int mapId = 12;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map17")){
				int mapId = 17;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map18")){
				int mapId = 18;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map23")){
				int mapId = 23;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map24")){
				int mapId = 24;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("2map25")){
				int mapId = 25;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}

		}
		//3.偃月
		else if(jinkei == 3){
			soudaisyo = PlayerPrefs.GetInt("soudaisyo3");

			if(PlayerPrefs.HasKey("3map3")){
				int mapId = 3;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map7")){
				int mapId = 7;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map8")){
				int mapId = 8;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map9")){
				int mapId = 9;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map11")){
				int mapId = 11;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map12")){
				int mapId = 12;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map14")){
				int mapId = 14;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map15")){
				int mapId = 15;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map16")){
				int mapId = 16;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map20")){
				int mapId = 20;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map21")){
				int mapId = 21;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("3map25")){
				int mapId = 25;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
		}

		//4.雁行
		else if(jinkei == 4){
			soudaisyo = PlayerPrefs.GetInt("soudaisyo4");

			if(PlayerPrefs.HasKey("4map1")){
				int mapId = 1;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map2")){
				int mapId = 2;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map7")){
				int mapId = 7;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map8")){
				int mapId = 8;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map12")){
				int mapId = 12;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map13")){
				int mapId = 13;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map14")){
				int mapId = 14;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map18")){
				int mapId = 18;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map19")){
				int mapId = 19;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map20")){
				int mapId = 20;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map24")){
				int mapId = 24;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
			if(PlayerPrefs.HasKey("4map25")){
				int mapId = 25;
				myBusyoList.Add(getStsAndMakeInstance(jinkei,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio));
			}
		}

		//Saku
		BusyoInfoGet info = new BusyoInfoGet();
		StatusGet sts = new StatusGet();
		GameObject content = GameObject.Find ("Content").gameObject;
		string slotPath = "Prefabs/Saku/Slot";
		Saku saku = new Saku ();

		foreach ( Transform n in content.transform ){
			GameObject.Destroy(n.gameObject);
		}

		foreach(int busyoId in myBusyoList){
			GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;

			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;
			sakuIcon.transform.SetParent (slot.transform);
			sakuIcon.transform.localScale = new Vector2 (0.45f, 0.45f);
			sakuIcon.GetComponent<Button>().enabled = false;

			slot.transform.SetParent (content.transform);
			slot.transform.localScale = new Vector2 (1, 1);

			slot.GetComponent<Saku>().sakuId = int.Parse(sakuList[0]);
			slot.GetComponent<Saku>().sakuEffect = int.Parse(sakuList[4]);

			if(sakuList[0] == "3"){
				//hukuhei
				//Heisyu
				slot.GetComponent<Saku>().sakuHeisyu = info.getHeisyu(busyoId);
				//Hei Status
				string heiId = "hei" + busyoId.ToString();
				string chParam = PlayerPrefs.GetString(heiId,"0");
				
				char[] delimiterChars = {':'};
				string[] ch_list = chParam.Split(delimiterChars);
				slot.GetComponent<Saku>().sakuHeiSts =  float.Parse (ch_list[3]);
				slot.GetComponent<Saku>().sakuBusyoId =  busyoId;

				//Busyo Speed
				int sakuBusyoLv = PlayerPrefs.GetInt(busyoId.ToString());
				slot.GetComponent<Saku>().sakuBusyoSpeed = sts.getSpd(busyoId,sakuBusyoLv);
			}



		}

		//Kengou
		string kengouString = PlayerPrefs.GetString("kengouItem");
		List<string> kengouList = new List<string> ();
		char[] delimiterChars3 = {','};
		kengouList = new List<string> (kengouString.Split (delimiterChars3));

		for (int i=0; i<kengouList.Count; i++) {
			int qty = int.Parse(kengouList[i]);
			if(qty != 0){
				GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;
				string kengouPath = "Prefabs/Saku/saku7";
				GameObject sakuIcon = Instantiate (Resources.Load (kengouPath)) as GameObject;
				sakuIcon.transform.SetParent (slot.transform);
				sakuIcon.transform.localScale = new Vector2 (0.45f, 0.45f);
				sakuIcon.GetComponent<Button>().enabled = false;

				slot.transform.SetParent (content.transform);
				slot.transform.localScale = new Vector2 (1, 1);

				ItemInfo item = new ItemInfo();
				int temp = i + 1;
				string itemCd = "kengou" + temp.ToString();
				string kengouName = item.getItemName(itemCd);
				sakuIcon.transform.FindChild("sakuIconText").GetComponent<Text>().text = kengouName;
				sakuIcon.transform.FindChild("sakuIconText").transform.localScale = new Vector2 (0.11f,0.15f);

				slot.GetComponent<Saku>().sakuId = 7;

				int effect = item.getItemEffect(itemCd);
				slot.GetComponent<Saku>().sakuEffect = effect;
				slot.GetComponent<Saku>().kengouCd = itemCd;
				slot.GetComponent<Saku>().kengouQty = qty;
				slot.GetComponent<Saku>().kengouName = kengouName;
			}
		}


		//Nanban
		string nanbanString = PlayerPrefs.GetString("nanbanItem");
		List<string> nanbanList = new List<string> ();
		nanbanList = new List<string> (nanbanString.Split (delimiterChars3));

		for (int i=0; i<nanbanList.Count; i++) {
			int qty = int.Parse(nanbanList[i]);
			if(qty != 0){
				GameObject slot = Instantiate (Resources.Load (slotPath)) as GameObject;

				string nanbanPath = "";
				if(i==0){
					nanbanPath = "Prefabs/Saku/saku8";
				}else if(i==1){
					nanbanPath = "Prefabs/Saku/saku9";
				}else if(i==2){
					nanbanPath = "Prefabs/Saku/saku10";
				}

				GameObject sakuIcon = Instantiate (Resources.Load (nanbanPath)) as GameObject;
				sakuIcon.transform.SetParent (slot.transform);
				sakuIcon.transform.localScale = new Vector2 (0.45f, 0.45f);
				sakuIcon.GetComponent<Button>().enabled = false;
				
				slot.transform.SetParent (content.transform);
				slot.transform.localScale = new Vector2 (1, 1);

				if(i==0){
					slot.GetComponent<Saku>().sakuId = 8;
				}else if(i==1){
					slot.GetComponent<Saku>().sakuId = 9;
				}else if(i==2){
					slot.GetComponent<Saku>().sakuId = 10;
				}

				int temp = i + 1;
				ItemInfo item = new ItemInfo();
				string itemCd = "nanban" + temp.ToString();
				int effect = item.getItemEffect(itemCd);
				slot.GetComponent<Saku>().sakuEffect = effect;


				if(i == 2){
					//teppou youhei
					slot.GetComponent<Saku>().sakuHeisyu = "TP";
					//Hei Status
					string heiId = "hei" + soudaisyo.ToString();
					string chParam = PlayerPrefs.GetString(heiId,"0");
					
					char[] delimiterChars = {':'};
					string[] ch_list = chParam.Split(delimiterChars);
					slot.GetComponent<Saku>().sakuHeiSts =  float.Parse (ch_list[3]);
					slot.GetComponent<Saku>().sakuBusyoId =  soudaisyo;
					
					//Busyo Speed
					int sakuBusyoLv = PlayerPrefs.GetInt(soudaisyo.ToString());
					slot.GetComponent<Saku>().sakuBusyoSpeed = sts.getSpd(soudaisyo,sakuBusyoLv);
				}

			}
		}



		/*エネミー配置*/
		int linkNo = PlayerPrefs.GetInt("activeLink",0);
		enemySoudaisyo = PlayerPrefs.GetInt("enemySoudaisyo");


		if(PlayerPrefs.HasKey("emap1")){
			int mapId = 1;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap2")){
			int mapId = 2;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap3")){
			int mapId = 3;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap4")){
			int mapId = 4;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap5")){
			int mapId = 5;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap6")){
			int mapId = 6;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap7")){
			int mapId = 7;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap8")){
			int mapId = 8;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap9")){
			int mapId = 9;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap10")){
			int mapId = 10;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap11")){
			int mapId = 11;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap12")){
			int mapId = 12;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap13")){
			int mapId = 13;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap14")){
			int mapId = 14;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap15")){
			int mapId = 15;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap16")){
			int mapId = 16;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap17")){
			int mapId = 17;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap18")){
			int mapId = 18;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap19")){
			int mapId = 19;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap20")){
			int mapId = 20;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap21")){
			int mapId = 21;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap22")){
			int mapId = 22;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap23")){
			int mapId = 23;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap24")){
			int mapId = 24;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}
		if(PlayerPrefs.HasKey("emap25")){
			int mapId = 25;
			getEnemyStsAndMakeInstance(linkNo,mapId, mntMinusRatio, seaMinusRatio, rainMinusRatio, snowMinusRatio);
		}


		/*Dynamic Enemy Setting Finish*/
		//合戦開始エフェクト
		string pathBack = "Prefabs/PreKassen/backGround";
		GameObject back = Instantiate(Resources.Load (pathBack)) as GameObject;
		back.transform.localScale = new Vector2 (30, 15);

		string pathLight = "Prefabs/PreKassen/lightning";
		GameObject light = Instantiate(Resources.Load (pathLight)) as GameObject;
		light.transform.localScale = new Vector2 (10, 10);



	}
Esempio n. 38
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;
                    }
                }
            }
        }
    }
Esempio n. 39
0
	public void viewBusyo(int[] hitBusyo){
		//Center View
		foreach ( Transform n in GameObject.Find ("CenterView").transform ){
			GameObject.Destroy(n.gameObject);
		}

		//1st
		string busyoPath1 = "Prefabs/Player/Unit/" + hitBusyo[0];
		GameObject busyo1 = Instantiate (Resources.Load (busyoPath1)) as GameObject;
		busyo1.transform.SetParent (GameObject.Find ("CenterView").transform);
		busyo1.transform.localScale = new Vector2 (8, 8);
		RectTransform busyo1_transform = busyo1.GetComponent<RectTransform>();
		busyo1_transform.anchoredPosition3D = new Vector3(200,180,0);
		busyo1_transform.sizeDelta = new Vector2( 30, 30);
		busyo1.GetComponent<DragHandler> ().enabled = false;	
		busyo1.transform.FindChild ("Text").GetComponent<Text> ().color = new Color (255, 255, 255, 255);

		//2nd
		string busyoPath2 = "Prefabs/Player/Unit/" + hitBusyo[1];
		GameObject busyo2 = Instantiate (Resources.Load (busyoPath2)) as GameObject;
		busyo2.transform.SetParent (GameObject.Find ("CenterView").transform);
		busyo2.transform.localScale = new Vector2 (8, 8);
		RectTransform busyo2_transform = busyo2.GetComponent<RectTransform>();
		busyo2_transform.anchoredPosition3D = new Vector3(600,180,0);
		busyo2_transform.sizeDelta = new Vector2( 30, 30);
		busyo2.GetComponent<DragHandler> ().enabled = false;	
		busyo2.transform.FindChild ("Text").GetComponent<Text> ().color = new Color (255, 255, 255, 255);

		//3rd
		string busyoPath3 = "Prefabs/Player/Unit/" + hitBusyo[2];
		GameObject busyo3 = Instantiate (Resources.Load (busyoPath3)) as GameObject;
		busyo3.transform.SetParent (GameObject.Find ("CenterView").transform);
		busyo3.transform.localScale = new Vector2 (8, 8);
		RectTransform busyo3_transform = busyo3.GetComponent<RectTransform>();
		busyo3_transform.anchoredPosition3D = new Vector3(1000,180,0);
		busyo3_transform.sizeDelta = new Vector2( 30, 30);
		busyo3.GetComponent<DragHandler> ().enabled = false;	
		busyo3.transform.FindChild ("Text").GetComponent<Text> ().color = new Color (255, 255, 255, 255);


		/*Button or Batu*/

		//Touyou history
		string touyouHst = PlayerPrefs.GetString("touyouHst");
		BusyoInfoGet busyo = new BusyoInfoGet ();

		if (touyouHst == null || touyouHst == "") {
			//OK can touyou

			//Show touyou button
			string buttonPath = "Prefabs/Touyou/Button";
			GameObject button1 = Instantiate (Resources.Load (buttonPath)) as GameObject;
			button1.transform.SetParent (busyo1.transform);
			button1.transform.localScale = new Vector2 (0.12f, 0.25f);
			RectTransform button1_transform = button1.GetComponent<RectTransform>();
			button1_transform.anchoredPosition = new Vector2 (0,-20);
			button1.GetComponent<TouyouView> ().busyoId = hitBusyo [0];
			string rank1 = busyo.getRank(hitBusyo [0]);
			button1.GetComponent<TouyouView> ().busyoRank = rank1;
			button1.name = "1";

			if(rank1 == "S" || rank1 == "A"){
				string effectPath = "Prefabs/Touyou/gacyaEffect" + rank1;
				GameObject effect = Instantiate (Resources.Load (effectPath)) as GameObject;
				effect.transform.SetParent (busyo1.transform);
				effect.transform.localScale = new Vector2 (18, 11);
				effect.transform.localPosition = new Vector3 (0, 10, 0);

			}

			GameObject button2 = Instantiate (Resources.Load (buttonPath)) as GameObject;
			button2.transform.SetParent (busyo2.transform);
			button2.transform.localScale = new Vector2 (0.12f, 0.25f);
			RectTransform button2_transform = button2.GetComponent<RectTransform>();
			button2_transform.anchoredPosition = new Vector2 (0,-20);
			button2.GetComponent<TouyouView> ().busyoId = hitBusyo [1];
			string rank2 = busyo.getRank(hitBusyo [1]);
			button2.GetComponent<TouyouView> ().busyoRank = rank2;
			button2.name = "2";

			if(rank2 == "S" || rank2 == "A"){
				string effectPath = "Prefabs/Touyou/gacyaEffect" + rank2;
				GameObject effect = Instantiate (Resources.Load (effectPath)) as GameObject;
				effect.transform.SetParent (busyo2.transform);
				effect.transform.localScale = new Vector2 (18, 11);
				effect.transform.localPosition = new Vector3 (0, 10, 0);
				
			}

			GameObject button3 = Instantiate (Resources.Load (buttonPath)) as GameObject;
			button3.transform.SetParent (busyo3.transform);
			button3.transform.localScale = new Vector2 (0.12f, 0.25f);
			RectTransform button3_transform = button3.GetComponent<RectTransform>();
			button3_transform.anchoredPosition = new Vector2 (0,-20);
			button3.GetComponent<TouyouView> ().busyoId = hitBusyo [2];
			string rank3 = busyo.getRank(hitBusyo [2]);
			button3.GetComponent<TouyouView> ().busyoRank = rank3;
			button3.name = "3";

			if(rank3 == "S" || rank3 == "A"){
				string effectPath = "Prefabs/Touyou/gacyaEffect" + rank3;
				GameObject effect = Instantiate (Resources.Load (effectPath)) as GameObject;
				effect.transform.SetParent (busyo3.transform);
				effect.transform.localScale = new Vector2 (18, 11);
				effect.transform.localPosition = new Vector3 (0, 10, 0);
				
			}

		} else {
			//NG already touyou
			string batuPath = "Prefabs/Touyou/Batu";
			char[] delimiterChars = {','};
			string[] tokens = touyouHst.Split(delimiterChars);
			if(tokens[0] == "1"){
				//Left
				GameObject batu1 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu1.transform.SetParent (busyo1.transform);
				batu1.transform.localScale = new Vector2 (1, 1);
				RectTransform batu1_transform = batu1.GetComponent<RectTransform>();
				batu1_transform.anchoredPosition = new Vector2 (0,0);

				GameObject batu2 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu2.transform.SetParent (busyo2.transform);
				batu2.transform.localScale = new Vector2 (1, 1);
				RectTransform batu2_transform = batu2.GetComponent<RectTransform>();
				batu2_transform.anchoredPosition = new Vector2 (0,0);
				batu2.transform.FindChild("TouyouZumiText").GetComponent<Text>().enabled = false;

				GameObject batu3 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu3.transform.SetParent (busyo3.transform);
				batu3.transform.localScale = new Vector2 (1, 1);
				RectTransform batu3_transform = batu3.GetComponent<RectTransform>();
				batu3_transform.anchoredPosition = new Vector2 (0,0);
				batu3.transform.FindChild("TouyouZumiText").GetComponent<Text>().enabled = false;


			}else if(tokens[1] == "1"){
				//Left
				GameObject batu1 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu1.transform.SetParent (busyo1.transform);
				batu1.transform.localScale = new Vector2 (1, 1);
				RectTransform batu1_transform = batu1.GetComponent<RectTransform>();
				batu1_transform.anchoredPosition = new Vector2 (0,0);
				batu1.transform.FindChild("TouyouZumiText").GetComponent<Text>().enabled = false;

				
				GameObject batu2 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu2.transform.SetParent (busyo2.transform);
				batu2.transform.localScale = new Vector2 (1, 1);
				RectTransform batu2_transform = batu2.GetComponent<RectTransform>();
				batu2_transform.anchoredPosition = new Vector2 (0,0);
				
				GameObject batu3 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu3.transform.SetParent (busyo3.transform);
				batu3.transform.localScale = new Vector2 (1, 1);
				RectTransform batu3_transform = batu3.GetComponent<RectTransform>();
				batu3_transform.anchoredPosition = new Vector2 (0,0);
				batu3.transform.FindChild("TouyouZumiText").GetComponent<Text>().enabled = false;

		
			}else if(tokens[2] == "1"){
				//Left
				GameObject batu1 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu1.transform.SetParent (busyo1.transform);
				batu1.transform.localScale = new Vector2 (1, 1);
				RectTransform batu1_transform = batu1.GetComponent<RectTransform>();
				batu1_transform.anchoredPosition = new Vector2 (0,0);
				batu1.transform.FindChild("TouyouZumiText").GetComponent<Text>().enabled = false;


				GameObject batu2 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu2.transform.SetParent (busyo2.transform);
				batu2.transform.localScale = new Vector2 (1, 1);
				RectTransform batu2_transform = batu2.GetComponent<RectTransform>();
				batu2_transform.anchoredPosition = new Vector2 (0,0);
				batu2.transform.FindChild("TouyouZumiText").GetComponent<Text>().enabled = false;

				GameObject batu3 = Instantiate (Resources.Load (batuPath)) as GameObject;
				batu3.transform.SetParent (busyo3.transform);
				batu3.transform.localScale = new Vector2 (1, 1);
				RectTransform batu3_transform = batu3.GetComponent<RectTransform>();
				batu3_transform.anchoredPosition = new Vector2 (0,0);
			}
		}
	}
Esempio n. 40
0
    public void MakeEvent(bool clearFlg, int kuniId, GameObject kuniMap, int enemyDaimyoId)
    {
        //Check No Commnet
        bool fromKassenFlg = PlayerPrefs.GetBool("fromKassenFlg");

        if (!fromKassenFlg)
        {
            if (clearFlg)
            {
                //cleared
                //1.Kokunin Ikki
                //2.Ikkou Ikki
                Debug.Log(clearFlg + ",ikki");
            }
            else
            {
                //never cleared

                /*1. Betlay in the case of isolation >> 5-20%*/
                //Count Link No
                List <int> noLinkStageList = new List <int>();
                foreach (Transform stage in kuniMap.transform)
                {
                    if (stage.gameObject.GetComponent <ShowStageDtl> ())
                    {
                        if (!stage.gameObject.GetComponent <ShowStageDtl> ().clearedFlg)
                        {
                            if (stage.gameObject.GetComponent <ShowStageDtl> ().linkNo <= 0)
                            {
                                noLinkStageList.Add(stage.gameObject.GetComponent <ShowStageDtl> ().stageId);
                            }
                        }
                    }
                }

                //Count Remain Stage and check there are over 2 stages
                string        clearedStage       = "kuni" + kuniId;
                string        clearedStageString = PlayerPrefs.GetString(clearedStage);
                List <string> clearedStageList   = new List <string> ();
                if (clearedStageString != null && clearedStageString != "")
                {
                    clearedStageList = new List <string> (clearedStageString.Split(delimiterChars));
                }


                if (0 < clearedStageList.Count && clearedStageList.Count < 9)
                {
                    if (noLinkStageList.Count != 0)
                    {
                        int        rdmId         = UnityEngine.Random.Range(0, noLinkStageList.Count);
                        int        betlayStageId = noLinkStageList [rdmId];
                        string     stageTmp      = "stage" + betlayStageId.ToString();
                        GameObject stageObj      = kuniMap.transform.FindChild(stageTmp).gameObject;
                        int        powerType     = stageObj.GetComponent <ShowStageDtl> ().powerType;

                        if (powerType == 1 || powerType == 2)
                        {
                            float eventRatio = 0;
                            if (powerType == 1)
                            {
                                eventRatio = 30;
                            }
                            else if (powerType == 2)
                            {
                                eventRatio = 15;
                            }

                            //test
                            //eventRatio = 100;

                            float percent = UnityEngine.Random.value;
                            percent = percent * 100;

                            if (percent < eventRatio)
                            {
                                //Hit
                                AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
                                audioSources [7].Play();

                                GameObject   commentObj    = MakeCommentObj(enemyDaimyoId, kuniId);
                                int          myDaimyoBusyo = PlayerPrefs.GetInt("myDaimyoBusyo");
                                int          myDaimyoId    = PlayerPrefs.GetInt("myDaimyo");
                                BusyoInfoGet busyo         = new BusyoInfoGet();
                                string       myDiamyoName  = busyo.getName(myDaimyoBusyo);
                                string       stageName     = stage.getStageName(kuniId, betlayStageId);
                                string       finalComment  = "";

                                if (Application.systemLanguage != SystemLanguage.Japanese)
                                {
                                    finalComment = "What? Isolated " + stageName + " castle betrayed " + myDiamyoName + ".";
                                }
                                else
                                {
                                    finalComment = "うぬう、何とした事だ。孤立した" + stageName + "が、" + myDiamyoName + "に寝返りおったわ。";
                                }
                                commentObj.transform.FindChild("SerihuText").GetComponent <Text> ().text = finalComment;

                                //Data Change
                                clearedStageString = clearedStageString + "," + betlayStageId;
                                PlayerPrefs.SetString(clearedStage, clearedStageString);
                                PlayerPrefs.Flush();

                                //Visualize & change value
                                string     clearedPath = "Prefabs/Map/cleared";
                                GameObject cleared     = Instantiate(Resources.Load(clearedPath)) as GameObject;
                                cleared.transform.SetParent(stageObj.transform);
                                stageObj.GetComponent <ShowStageDtl> ().clearedFlg = true;
                                cleared.transform.localScale    = new Vector2(3, 5);
                                cleared.transform.localPosition = new Vector2(0, 0);
                                stageObj.GetComponent <ShowStageDtl> ().clearedFlg = true;

                                string     animPath = "Prefabs/Map/stage/betrayAnimation";
                                GameObject anim     = Instantiate(Resources.Load(animPath)) as GameObject;
                                anim.transform.SetParent(stageObj.transform);
                                anim.transform.localScale    = new Vector2(8, 4);
                                anim.transform.localPosition = new Vector2(0, 0);
                            }
                        }
                    }
                }



                //1.Enemy Daimyo Attack(if there is enemy shiro)
                //Not Yet
            }
        }
    }
Esempio n. 41
0
    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);
        }
    }
Esempio n. 42
0
    public void visualizeBusyo2(int[] hitBusyo)
    {
        string     busyoPath1 = "Prefabs/Player/Unit/BusyoUnit";
        GameObject busyo1     = Instantiate(Resources.Load(busyoPath1)) as GameObject;

        busyo1.name = hitBusyo[0].ToString();
        busyo1.transform.SetParent(GameObject.Find("CenterView").transform);
        busyo1.transform.localScale = new Vector2(8, 8);
        RectTransform busyo1_transform = busyo1.GetComponent <RectTransform>();

        busyo1_transform.anchoredPosition3D          = new Vector3(200, 180, 0);
        busyo1_transform.sizeDelta                   = new Vector2(30, 30);
        busyo1.GetComponent <DragHandler> ().enabled = false;
        busyo1.transform.FindChild("Text").GetComponent <Text> ().color = new Color(255, 255, 255, 255);

        //2nd
        string     busyoPath2 = "Prefabs/Player/Unit/BusyoUnit";
        GameObject busyo2     = Instantiate(Resources.Load(busyoPath2)) as GameObject;

        busyo2.name = hitBusyo[1].ToString();
        busyo2.transform.SetParent(GameObject.Find("CenterView").transform);
        busyo2.transform.localScale = new Vector2(8, 8);
        RectTransform busyo2_transform = busyo2.GetComponent <RectTransform>();

        busyo2_transform.anchoredPosition3D          = new Vector3(600, 180, 0);
        busyo2_transform.sizeDelta                   = new Vector2(30, 30);
        busyo2.GetComponent <DragHandler> ().enabled = false;
        busyo2.transform.FindChild("Text").GetComponent <Text> ().color = new Color(255, 255, 255, 255);

        //3rd
        string     busyoPath3 = "Prefabs/Player/Unit/BusyoUnit";
        GameObject busyo3     = Instantiate(Resources.Load(busyoPath3)) as GameObject;

        busyo3.name = hitBusyo[2].ToString();
        busyo3.transform.SetParent(GameObject.Find("CenterView").transform);
        busyo3.transform.localScale = new Vector2(8, 8);
        RectTransform busyo3_transform = busyo3.GetComponent <RectTransform>();

        busyo3_transform.anchoredPosition3D          = new Vector3(1000, 180, 0);
        busyo3_transform.sizeDelta                   = new Vector2(30, 30);
        busyo3.GetComponent <DragHandler> ().enabled = false;
        busyo3.transform.FindChild("Text").GetComponent <Text> ().color = new Color(255, 255, 255, 255);


        /*Button or Batu*/

        //Touyou history
        string       touyouHst = PlayerPrefs.GetString("touyouHst");
        BusyoInfoGet busyo     = new BusyoInfoGet();

        if (touyouHst == null || touyouHst == "")
        {
            //OK can touyou

            //Show touyou button
            string     buttonPath = "Prefabs/Touyou/Button";
            GameObject button1    = Instantiate(Resources.Load(buttonPath)) as GameObject;
            button1.transform.SetParent(busyo1.transform);
            button1.transform.localScale = new Vector2(0.12f, 0.25f);
            RectTransform button1_transform = button1.GetComponent <RectTransform>();
            button1_transform.anchoredPosition           = new Vector2(0, -20);
            button1.GetComponent <TouyouView> ().busyoId = hitBusyo [0];
            string rank1 = busyo.getRank(hitBusyo [0]);
            button1.GetComponent <TouyouView> ().busyoRank = rank1;
            button1.name = "1";

            if (rank1 == "S" || rank1 == "A")
            {
                string     effectPath = "Prefabs/Touyou/gacyaEffect" + rank1;
                GameObject effect     = Instantiate(Resources.Load(effectPath)) as GameObject;
                effect.transform.SetParent(busyo1.transform);
                effect.transform.localScale    = new Vector2(18, 11);
                effect.transform.localPosition = new Vector3(0, 10, 0);
            }

            GameObject button2 = Instantiate(Resources.Load(buttonPath)) as GameObject;
            button2.transform.SetParent(busyo2.transform);
            button2.transform.localScale = new Vector2(0.12f, 0.25f);
            RectTransform button2_transform = button2.GetComponent <RectTransform>();
            button2_transform.anchoredPosition           = new Vector2(0, -20);
            button2.GetComponent <TouyouView> ().busyoId = hitBusyo [1];
            string rank2 = busyo.getRank(hitBusyo [1]);
            button2.GetComponent <TouyouView> ().busyoRank = rank2;
            button2.name = "2";

            if (rank2 == "S" || rank2 == "A")
            {
                string     effectPath = "Prefabs/Touyou/gacyaEffect" + rank2;
                GameObject effect     = Instantiate(Resources.Load(effectPath)) as GameObject;
                effect.transform.SetParent(busyo2.transform);
                effect.transform.localScale    = new Vector2(18, 11);
                effect.transform.localPosition = new Vector3(0, 10, 0);
            }

            GameObject button3 = Instantiate(Resources.Load(buttonPath)) as GameObject;
            button3.transform.SetParent(busyo3.transform);
            button3.transform.localScale = new Vector2(0.12f, 0.25f);
            RectTransform button3_transform = button3.GetComponent <RectTransform>();
            button3_transform.anchoredPosition           = new Vector2(0, -20);
            button3.GetComponent <TouyouView> ().busyoId = hitBusyo [2];
            string rank3 = busyo.getRank(hitBusyo [2]);
            button3.GetComponent <TouyouView> ().busyoRank = rank3;
            button3.name = "3";

            if (rank3 == "S" || rank3 == "A")
            {
                string     effectPath = "Prefabs/Touyou/gacyaEffect" + rank3;
                GameObject effect     = Instantiate(Resources.Load(effectPath)) as GameObject;
                effect.transform.SetParent(busyo3.transform);
                effect.transform.localScale    = new Vector2(18, 11);
                effect.transform.localPosition = new Vector3(0, 10, 0);
            }
        }
        else
        {
            //NG already touyou
            string   batuPath       = "Prefabs/Touyou/Batu";
            char[]   delimiterChars = { ',' };
            string[] tokens         = touyouHst.Split(delimiterChars);
            if (tokens[0] == "1")
            {
                //Left
                GameObject batu1 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu1.transform.SetParent(busyo1.transform);
                batu1.transform.localScale = new Vector2(1, 1);
                RectTransform batu1_transform = batu1.GetComponent <RectTransform>();
                batu1_transform.anchoredPosition = new Vector2(0, 0);

                GameObject batu2 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu2.transform.SetParent(busyo2.transform);
                batu2.transform.localScale = new Vector2(1, 1);
                RectTransform batu2_transform = batu2.GetComponent <RectTransform>();
                batu2_transform.anchoredPosition = new Vector2(0, 0);
                batu2.transform.FindChild("TouyouZumiText").GetComponent <Text>().enabled = false;

                GameObject batu3 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu3.transform.SetParent(busyo3.transform);
                batu3.transform.localScale = new Vector2(1, 1);
                RectTransform batu3_transform = batu3.GetComponent <RectTransform>();
                batu3_transform.anchoredPosition = new Vector2(0, 0);
                batu3.transform.FindChild("TouyouZumiText").GetComponent <Text>().enabled = false;
            }
            else if (tokens[1] == "1")
            {
                //Left
                GameObject batu1 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu1.transform.SetParent(busyo1.transform);
                batu1.transform.localScale = new Vector2(1, 1);
                RectTransform batu1_transform = batu1.GetComponent <RectTransform>();
                batu1_transform.anchoredPosition = new Vector2(0, 0);
                batu1.transform.FindChild("TouyouZumiText").GetComponent <Text>().enabled = false;


                GameObject batu2 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu2.transform.SetParent(busyo2.transform);
                batu2.transform.localScale = new Vector2(1, 1);
                RectTransform batu2_transform = batu2.GetComponent <RectTransform>();
                batu2_transform.anchoredPosition = new Vector2(0, 0);

                GameObject batu3 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu3.transform.SetParent(busyo3.transform);
                batu3.transform.localScale = new Vector2(1, 1);
                RectTransform batu3_transform = batu3.GetComponent <RectTransform>();
                batu3_transform.anchoredPosition = new Vector2(0, 0);
                batu3.transform.FindChild("TouyouZumiText").GetComponent <Text>().enabled = false;
            }
            else if (tokens[2] == "1")
            {
                //Left
                GameObject batu1 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu1.transform.SetParent(busyo1.transform);
                batu1.transform.localScale = new Vector2(1, 1);
                RectTransform batu1_transform = batu1.GetComponent <RectTransform>();
                batu1_transform.anchoredPosition = new Vector2(0, 0);
                batu1.transform.FindChild("TouyouZumiText").GetComponent <Text>().enabled = false;


                GameObject batu2 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu2.transform.SetParent(busyo2.transform);
                batu2.transform.localScale = new Vector2(1, 1);
                RectTransform batu2_transform = batu2.GetComponent <RectTransform>();
                batu2_transform.anchoredPosition = new Vector2(0, 0);
                batu2.transform.FindChild("TouyouZumiText").GetComponent <Text>().enabled = false;

                GameObject batu3 = Instantiate(Resources.Load(batuPath)) as GameObject;
                batu3.transform.SetParent(busyo3.transform);
                batu3.transform.localScale = new Vector2(1, 1);
                RectTransform batu3_transform = batu3.GetComponent <RectTransform>();
                batu3_transform.anchoredPosition = new Vector2(0, 0);
            }
        }
    }
Esempio n. 43
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);
            }
        }
    }
Esempio n. 44
0
	//PowerType2
	//Busyo + Busyo
	public int powerType2(List<int> mapList, int taisyoMapId, int linkNo,  int activeDaimyoId){
		int totalHei = 0;

		int activeBusyoQty = PlayerPrefs.GetInt ("activeBusyoQty");
		int activeBusyoLv = PlayerPrefs.GetInt ("activeBusyoLv");
		int activeButaiQty = PlayerPrefs.GetInt ("activeButaiQty");
		int activeButaiLv = PlayerPrefs.GetInt ("activeButaiLv");
		Entity_daimyo_mst daimyoMst = Resources.Load ("Data/daimyo_mst") as Entity_daimyo_mst;
		int daimyoBusyoId = daimyoMst.param[activeDaimyoId-1].busyoId;


		/*Busyo Master Setting Start*/
		//Active Busyo List
		List<string> metsubouDaimyoList = new List<string> ();
		string metsubouTemp = "metsubou" + activeDaimyoId;
		string metsubouDaimyoString = PlayerPrefs.GetString (metsubouTemp);
		char[] delimiterChars2 = {','};
		if (metsubouDaimyoString != null && metsubouDaimyoString != "") {
			if (metsubouDaimyoString.Contains (",")) {
				metsubouDaimyoList = new List<string> (metsubouDaimyoString.Split (delimiterChars2));
			} else {
				metsubouDaimyoList = new List<string> (metsubouDaimyoString.Split (delimiterChars2));
			}
		}
		metsubouDaimyoList.Add (activeDaimyoId.ToString ());
		
		Entity_busyo_mst busyoMst = Resources.Load ("Data/busyo_mst") as Entity_busyo_mst;
		List<int> busyoList = new List<int> ();
		
		for (int i=0; i<busyoMst.param.Count; i++) {
			int busyoId = busyoMst.param [i].id;
			int daimyoId = busyoMst.param [i].daimyoId;
			
			if (metsubouDaimyoList.Contains (daimyoId.ToString ())) {
				if (busyoId != daimyoBusyoId) {
					
					busyoList.Add (busyoId);
				}
			}
		}
		/*Busyo Master Setting End*/
		
		/*Random Shuffle*/
		for (int i = 0; i < busyoList.Count; i++) {
			int temp = busyoList [i];
			int randomIndex = UnityEngine.Random.Range (0, busyoList.Count);
			busyoList [i] = busyoList [randomIndex];
			busyoList [randomIndex] = temp;
		}
		
		for (int i = 0; i < mapList.Count; i++) {
			int temp = mapList [i];
			int randomIndex = UnityEngine.Random.Range (0, mapList.Count);
			mapList [i] = mapList [randomIndex];
			mapList [randomIndex] = temp;
		}
		
		
		/*Taisyo Setting Start*/
		GameObject EnemyJinkeiView = GameObject.Find ("EnemyJinkeiView").gameObject;
		int taisyoBusyoId = busyoList[0];
		
		StatusGet sts = new StatusGet();
		BusyoInfoGet info = new BusyoInfoGet();
		
		int hp = sts.getHp(taisyoBusyoId,activeBusyoLv);
		hp = hp * 100;
		
		//Link Status Adjustment
		if (linkNo != 0) {
			float linkAdjst = (float)linkNo/10;
			float adjstHp = hp * linkAdjst;
			hp = hp + (int)adjstHp;
		}

		string TaisyoBusyoName = info.getName(taisyoBusyoId);
		string TaisyoType = info.getHeisyu(taisyoBusyoId);

		int chldHp = activeButaiQty * enemyIns.getChildStatus (activeButaiLv, TaisyoType, linkNo);
		totalHei = hp + chldHp;

		string path = "Prefabs/Player/Unit/" + taisyoBusyoId;
		GameObject tsyBusyo = Instantiate(Resources.Load (path)) as GameObject;

		string slotName = "Slot" + taisyoMapId;
		tsyBusyo.transform.SetParent(EnemyJinkeiView.transform.FindChild(slotName).transform);
		tsyBusyo.name = taisyoBusyoId.ToString();
		tsyBusyo.transform.localScale = new Vector2(-3,3);
		tsyBusyo.transform.localPosition = new Vector3(0, 0, 0);
		tempEnemySoudaisyo = int.Parse (tsyBusyo.name);

		//Button
		string soudaisyoPath = "Prefabs/Jinkei/soudaisyo";
		GameObject soudaisyo = Instantiate (Resources.Load (soudaisyoPath)) as GameObject;
		soudaisyo.transform.SetParent (tsyBusyo.transform);
		soudaisyo.transform.localScale = new Vector2 (27, 12);
		soudaisyo.name = "enemySoudaisyo";
		soudaisyo.transform.localPosition = new Vector3(0, 11, 0);
		tsyBusyo.GetComponent<DragHandler> ().enabled = false;

		//Text
		GameObject txtObj = tsyBusyo.transform.FindChild ("Text").gameObject;
		Vector2 txtScale = txtObj.transform.localScale;
		txtScale.x *= -1;
		txtObj.transform.localScale = txtScale;
		Vector2 txtPos = txtObj.transform.localPosition;
		txtPos.x *= -1;
		txtObj.transform.localPosition = txtPos;

		GameObject rblObj = tsyBusyo.transform.FindChild ("Rank").gameObject;
		Vector2 rblScale = rblObj.transform.localScale;
		rblScale.x *= -1;
		rblObj.transform.localScale = rblScale;
		Vector2 rblPos = rblObj.transform.localPosition;
		rblPos.x *= -1;
		rblObj.transform.localPosition = rblPos;

		GameObject tsyTxtObj = tsyBusyo.transform.FindChild ("enemySoudaisyo").transform.FindChild("Text").gameObject;
		Vector2 tsyScale = tsyTxtObj.transform.localScale;
		tsyScale.x *= -1;
		tsyTxtObj.transform.localScale = tsyScale;
		Vector2 tsyPos = tsyTxtObj.transform.localPosition;
		tsyPos.x *= -1;
		tsyTxtObj.transform.localPosition = tsyPos;

		/*Taisyo Setting End*/
		
		
		//Make Instance
		busyoList.Remove (taisyoBusyoId);
		int busyoListCount = busyoList.Count;
		for (int j=0; j<activeBusyoQty-1; j++) {
			
			if (busyoListCount > 0) {
				int randomBusyoId = busyoList [j];
				busyoListCount = busyoListCount - 1;
				int mapId = mapList [j];

				//Status
				if (randomBusyoId != 0) {
					int busyoHp = sts.getHp (randomBusyoId, activeBusyoLv);
					busyoHp = busyoHp * 100;
					
					//Link Status Adjustment
					if (linkNo != 0) {
						float linkAdjst = (float)linkNo/10;
						float adjstHp = busyoHp * linkAdjst;
						busyoHp = busyoHp + (int)adjstHp;
					}
					
					string busyoName = info.getName (randomBusyoId);
					string busyoType = info.getHeisyu (randomBusyoId);

					int chldHp2 = activeButaiQty * enemyIns.getChildStatus (activeButaiLv, busyoType, linkNo);
					totalHei = totalHei + busyoHp + chldHp2;

					string busyoPath = "Prefabs/Player/Unit/" + randomBusyoId;
					GameObject chdBusyo = Instantiate(Resources.Load (busyoPath)) as GameObject;
					
					string chdSlotName = "Slot" + mapId;
					chdBusyo.transform.SetParent(EnemyJinkeiView.transform.FindChild(chdSlotName).transform);
					chdBusyo.name = randomBusyoId.ToString();
					chdBusyo.transform.localScale = new Vector2(-3,3);
					chdBusyo.transform.localPosition = new Vector3(0, 0, 0);

					//Button
					chdBusyo.GetComponent<DragHandler> ().enabled = false;
					
					//Text
					GameObject chTxtObj = chdBusyo.transform.FindChild ("Text").gameObject;
					Vector2 chTxtScale = chTxtObj.transform.localScale;
					chTxtScale.x *= -1;
					chTxtObj.transform.localScale = chTxtScale;
					Vector2 chTxtPos = chTxtObj.transform.localPosition;
					chTxtPos.x *= -1;
					chTxtObj.transform.localPosition = chTxtPos;

					GameObject chRblObj = chdBusyo.transform.FindChild ("Rank").gameObject;
					Vector2 chRblScale = chRblObj.transform.localScale;
					chRblScale.x *= -1;
					chRblObj.transform.localScale = chRblScale;
					Vector2 chRblPos = chRblObj.transform.localPosition;
					chRblPos.x *= -1;
					chRblObj.transform.localPosition = chRblPos;
				}
			}else{
				//samurai daisyo make
				busyoListCount = busyoListCount - 1;
				int mapId = mapList [j];
				
				int busyoHp = sts.getHp (35, activeBusyoLv);
				busyoHp = busyoHp * 100;
				
				//Link Status Adjustment
				if (linkNo != 0) {
					float linkAdjst = (float)linkNo/10;
					float adjstHp = busyoHp * linkAdjst;
					busyoHp = busyoHp + (int)adjstHp;
				}
				
				string busyoName = info.getName (35);
				string[] texts = new string[] { "YR", "KB"};
				string busyoType = texts[UnityEngine.Random.Range(0, texts.Length - 1)];

				int chldHp2 = activeButaiQty * enemyIns.getChildStatus (activeButaiLv, busyoType, linkNo);
				totalHei = totalHei + busyoHp + chldHp2;

				string busyoPath = "Prefabs/Player/Unit/35";
				GameObject chdBusyo = Instantiate(Resources.Load (busyoPath)) as GameObject;
				
				string chdSlotName = "Slot" + mapId;
				chdBusyo.transform.SetParent(EnemyJinkeiView.transform.FindChild(chdSlotName).transform);
				chdBusyo.name = "35";
				chdBusyo.transform.localScale = new Vector2(-3,3);
				chdBusyo.transform.localPosition = new Vector3(0, 0, 0);

				//Button
				chdBusyo.GetComponent<DragHandler> ().enabled = false;
				
				//Rabel & Text
				GameObject chTxtObj = chdBusyo.transform.FindChild ("Text").gameObject;
				Vector2 chTxtScale = chTxtObj.transform.localScale;
				chTxtScale.x *= -1;
				chTxtObj.transform.localScale = chTxtScale;
				Vector2 chTxtPos = chTxtObj.transform.localPosition;
				chTxtPos.x *= -1;
				chTxtObj.transform.localPosition = chTxtPos;
			}
		}

		return totalHei;
	}