Exemplo n.º 1
0
    public void makeSimpleEnemy(int busyoId, GameObject battleArea, int xAdjust, GameObject YesBtn)
    {
        string     path   = "Prefabs/Player/" + busyoId;
        GameObject prefab = Instantiate(Resources.Load(path)) as GameObject;

        prefab.name = busyoId.ToString();
        prefab.transform.SetParent(battleArea.transform);
        prefab.transform.localScale = new Vector2(-0.4f, 0.6f);
        prefab.GetComponent <SpriteRenderer>().sortingLayerName = "UI";
        prefab.GetComponent <SpriteRenderer>().sortingOrder     = 350;

        /**Player to Enemy**/
        prefab.tag   = "Enemy";
        prefab.layer = LayerMask.NameToLayer("Enemy");
        /**Player to Enemy End**/

        float xAdjust2 = (float)xAdjust / 5;

        prefab.transform.localPosition = new Vector2(9 - xAdjust2, 1.8f);
        prefab.GetComponent <Rigidbody2D>().gravityScale = 1;

        //Set Scirpt
        Destroy(prefab.GetComponent <PlayerHP>());
        Destroy(prefab.GetComponent <SenpouController>());
        Destroy(prefab.GetComponent <LineLocation>());
        if (prefab.GetComponent <HomingLong>())
        {
            Destroy(prefab.GetComponent <HomingLong>());
            prefab.AddComponent <Homing>();
        }
        if (prefab.GetComponent <AttackLong>())
        {
            Destroy(prefab.GetComponent <AttackLong>());
        }
        else
        {
            Destroy(prefab.GetComponent <PlayerAttack>());
        }
        Destroy(prefab.GetComponent <PlayerHP>());
        prefab.AddComponent <SimpleAttack>();
        prefab.AddComponent <SimpleHP>();
        prefab.AddComponent <Homing>();
        prefab.GetComponent <Homing>().speed   = 50;
        prefab.GetComponent <Homing>().enabled = false;

        YesBtn.GetComponent <StartSimpleKassen>().busyoObjList.Add(prefab);

        //Parametor
        StartKassen stksn       = GameObject.Find("BattleButton").GetComponent <StartKassen>();
        int         lv          = stksn.activeBusyoLv;
        string      busyoString = busyoId.ToString();
        StatusGet   sts         = new StatusGet();
        int         hp          = 100 * sts.getHp(busyoId, lv);
        int         atk         = 10 * sts.getAtk(busyoId, lv);
        int         dfc         = 10 * sts.getDfc(busyoId, lv);
        float       spd         = sts.getSpd(busyoId, lv);


        //Child Parametor
        int           chlv          = stksn.activeButaiLv;
        int           chQty         = stksn.activeButaiQty;
        EnemyInstance enemyInstance = new EnemyInstance();
        string        ch_type       = sts.getHeisyu(busyoId);
        int           ch_status     = enemyInstance.getChildStatus(lv, ch_type, 0);
        int           totalChldHp   = 0;
        int           totalChldAtk  = 0;
        int           totalChldDfc  = 0;
        int           atkDfc        = (int)sts.getChAtkDfc(ch_status, hp);

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

        //Set value
        hp  = hp + totalChldHp;
        atk = atk + totalChldAtk;
        dfc = dfc + totalChldDfc;

        prefab.GetComponent <Homing>().speed         = spd / 20;
        prefab.GetComponent <SimpleAttack>().atk     = atk;
        prefab.GetComponent <SimpleHP>().dfc         = dfc;
        prefab.GetComponent <SimpleAttack>().baseAtk = atk;
        prefab.GetComponent <SimpleHP>().baseDfc     = dfc;
        prefab.GetComponent <SimpleHP>().life        = hp;
    }
Exemplo n.º 2
0
    public void OnClick()
    {
        int     nowHyourou = PlayerPrefs.GetInt("hyourou");
        Message msg        = new Message();

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

        if (name == "Back")
        {
            scrollObj.SetActive(false);
            audioSources [1].Play();
        }
        else
        {
            if (nowHyourou < 2)
            {
                msg.makeUpperMessageOnBoard(msg.getMessage(7));
            }
            else
            {
                //Track
                int TrackBouryakuNo = PlayerPrefs.GetInt("TrackBouryakuNo", 0);
                TrackBouryakuNo = TrackBouryakuNo + 1;
                PlayerPrefs.SetInt("TrackBouryakuNo", TrackBouryakuNo);


                nowHyourou = nowHyourou - 2;
                PlayerPrefs.SetInt("hyourou", nowHyourou);
                GameObject.Find("HyourouCurrentValue").GetComponent <Text> ().text = nowHyourou.ToString();

                //Do
                StartKassen script = GameObject.Find("BattleButton").GetComponent <StartKassen> ();
                activeKuniId  = script.activeKuniId;
                activeStageId = script.activeStageId;

                DoGaikou addUsedBusyo = new DoGaikou();


                if (linkCutFlg)
                {
                    //link cut

                    //Make target list
                    string     temp    = "kuniMap" + activeKuniId;
                    GameObject kuniMap = GameObject.Find(temp).gameObject;

                    List <string> targetList = new List <string> ();
                    foreach (Transform obj in kuniMap.transform)
                    {
                        if (obj.tag == "Link")
                        {
                            string objName = obj.name;
                            objName = objName.Replace("link", "");

                            List <string> linkList       = new List <string> ();
                            char[]        delimiterChars = { '-' };
                            linkList = new List <string> (objName.Split(delimiterChars));

                            if (int.Parse(linkList [0]) == activeStageId)
                            {
                                targetList.Add(objName);
                            }
                            else if (int.Parse(linkList [1]) == activeStageId)
                            {
                                targetList.Add(objName);
                            }
                        }
                    }



                    okRatio = ((float)cyouhouSnbRankId * (float)dfc) / 8;
                    if (targetList.Count != 0)
                    {
                        int  okCount  = 0;
                        bool okMsgFlg = false;
                        for (int i = 0; i < targetList.Count; i++)
                        {
                            //success or not
                            float percent = UnityEngine.Random.value;
                            percent = percent * 100;

                            if (percent <= okRatio)
                            {
                                //Track
                                int TrackBouryakuSuccessNo = PlayerPrefs.GetInt("TrackBouryakuSuccessNo", 0);
                                TrackBouryakuSuccessNo = TrackBouryakuSuccessNo + 1;
                                PlayerPrefs.SetInt("TrackBouryakuSuccessNo", TrackBouryakuSuccessNo);

                                //OK Cut
                                okMsgFlg = true;
                                string     target    = "link" + targetList [i];
                                GameObject targetObj = kuniMap.transform.FindChild(target).gameObject;
                                Destroy(targetObj.gameObject);


                                //Register Data
                                string tempLinkuct = "linkcut" + activeKuniId;
                                string linkcut     = PlayerPrefs.GetString(tempLinkuct);
                                string newLinkcut  = "";
                                if (linkcut != null && linkcut != "")
                                {
                                    newLinkcut = linkcut + "," + targetList [i];
                                }
                                else
                                {
                                    newLinkcut = targetList [i];
                                }
                                PlayerPrefs.SetString(tempLinkuct, newLinkcut);

                                PlayerPrefs.SetBool("questDailyFlg34", true);
                                PlayerPrefs.Flush();

                                MainStageController mainStage = new MainStageController();
                                mainStage.questExtension();

                                //Reduce Cut No.
                                List <string> linkList       = new List <string> ();
                                char[]        delimiterChars = { '-' };
                                linkList = new List <string> (targetList [i].Split(delimiterChars));

                                string stage1 = "stage" + linkList [0];
                                string stage2 = "stage" + linkList [1];

                                foreach (Transform obj in kuniMap.transform)
                                {
                                    if (obj.tag != "Link")
                                    {
                                        if (obj.name == stage1 || obj.name == stage2)
                                        {
                                            obj.GetComponent <ShowStageDtl> ().linkNo = obj.GetComponent <ShowStageDtl> ().linkNo - 1;
                                        }
                                    }
                                }

                                okCount = okCount + 1;
                            }
                        }
                        if (okMsgFlg)
                        {
                            int TrackLinkCutNo = PlayerPrefs.GetInt("TrackLinkCutNo", 0);
                            TrackLinkCutNo = TrackLinkCutNo + okCount;
                            PlayerPrefs.SetInt("TrackLinkCutNo", TrackLinkCutNo);
                            PlayerPrefs.Flush();
                            if (Application.systemLanguage != SystemLanguage.Japanese)
                            {
                                msg.makeUpperMessageOnBoard("You cut " + okCount + " line. \n Enemy power keep be down in this season.");
                            }
                            else
                            {
                                msg.makeUpperMessageOnBoard("連絡線を" + okCount + "本遮断しました。\n今季節中は敵戦力が減りますぞ。");
                            }
                            addUsedBusyo.addUsedBusyo(busyoId);
                        }
                        else
                        {
                            msg.makeUpperMessageOnBoard(msg.getMessage(126));
                        }
                    }
                    else
                    {
                        msg.makeUpperMessageOnBoard(msg.getMessage(127));
                    }
                }
                else
                {
                    //cyouryaku
                    okRatio = ((float)cyouhouSnbRankId * (float)dfc) / 8;

                    float percent = UnityEngine.Random.value;
                    percent = percent * 100;

                    if (percent <= okRatio)
                    {
                        //OK
                        //Track
                        int TrackBouryakuSuccessNo = PlayerPrefs.GetInt("TrackBouryakuSuccessNo", 0);
                        TrackBouryakuSuccessNo = TrackBouryakuSuccessNo + 1;
                        PlayerPrefs.SetInt("TrackBouryakuSuccessNo", TrackBouryakuSuccessNo);

                        string cyouryaku    = PlayerPrefs.GetString("cyouryaku");
                        string cyouryakuTmp = activeKuniId.ToString() + "cyouryaku" + activeStageId.ToString();
                        if (cyouryaku != null && cyouryaku != "")
                        {
                            cyouryaku = cyouryaku + "," + cyouryakuTmp;
                        }
                        else
                        {
                            cyouryaku = cyouryakuTmp;
                        }
                        PlayerPrefs.SetString("cyouryaku", cyouryaku);


                        int cyouryakuHeiQty = 0;
                        if (cyouhouSnbRankId == 1)
                        {
                            cyouryakuHeiQty = UnityEngine.Random.Range(1, 3);
                        }
                        else if (cyouhouSnbRankId == 2)
                        {
                            cyouryakuHeiQty = UnityEngine.Random.Range(1, 4);
                        }
                        else if (cyouhouSnbRankId == 3)
                        {
                            cyouryakuHeiQty = UnityEngine.Random.Range(1, 6);
                        }

                        PlayerPrefs.SetInt(cyouryakuTmp, cyouryakuHeiQty);
                        PlayerPrefs.SetBool("questDailyFlg35", true);

                        int TrackCyouryakuNo = PlayerPrefs.GetInt("TrackCyouryakuNo", 0);
                        TrackCyouryakuNo = TrackCyouryakuNo + cyouryakuHeiQty;
                        PlayerPrefs.SetInt("TrackCyouryakuNo", TrackCyouryakuNo);
                        PlayerPrefs.Flush();

                        MainStageController mainStage = new MainStageController();
                        mainStage.questExtension();
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            msg.makeUpperMessageOnBoard("You are succeed to win over. \n Enemy " + cyouryakuHeiQty.ToString() + " unit will change to player unit in a battle.");
                        }
                        else
                        {
                            msg.makeUpperMessageOnBoard("調略に成功しましたぞ。\n合戦にて" + cyouryakuHeiQty.ToString() + "部隊が寝返ります。");
                        }
                        addUsedBusyo.addUsedBusyo(busyoId);
                    }
                    else
                    {
                        msg.makeUpperMessageOnBoard(msg.getMessage(128));
                    }
                }

                //Push Back Button
                scrollObj.SetActive(false);
            }
        }
    }
Exemplo n.º 3
0
    //Asset Manager
    //public AssetBundleManager assetBundleManager;
    //public Image image;

    //public IEnumerator Start() {
    //
    //assetBundleManager = GameObject.Find("AssetManager").GetComponent<AssetBundleManager>();
    //
    //    yield return StartCoroutine(assetBundleManager.LoadAssetBundleCoroutine());
    //
    //}


    public void OnClick()
    {
        cyouhouSnbRankId = transform.parent.gameObject.transform.FindChild("close").GetComponent <CloseBoard>().cyouhouSnbRankId;

        //SE
        sound = GameObject.Find("SEController").GetComponent <AudioSource> ();
        sound.PlayOneShot(sound.clip);


        /*Common Process*/
        string     pathOfBoard = "Prefabs/Map/Popup";
        GameObject board       = Instantiate(Resources.Load(pathOfBoard)) as GameObject;

        board.transform.parent        = GameObject.Find("Map").transform;
        board.transform.localScale    = new Vector2(1, 0.8f);
        board.transform.localPosition = new Vector2(0, 0);
        board.name = "AttackStagePopup";
        Daimyo daimyo = new Daimyo();

        char[] delimiterChars = { ',' };

        if (Application.loadedLevelName == "tutorialMain")
        {
            board.transform.FindChild("board").transform.FindChild("close").gameObject.SetActive(false);
        }

        /*Indivisual Process by Kuni*/
        string     pathOfKuniMap = "Prefabs/Map/stage/kuniMap";
        GameObject kuniMap       = Instantiate(Resources.Load(pathOfKuniMap)) as GameObject;

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

        string kuniImagePath   = "Prefabs/Map/stage/MapSprite/stage" + kuniId.ToString();
        string assetBundlePath = "stage" + kuniId.ToString();

        kuniMap.GetComponent <Image> ().sprite =
            Resources.Load(kuniImagePath, typeof(Sprite)) as Sprite;
        //assetBundleManager.GetSpriteFromAssetBundle(assetBundlePath); //Asset
        //assetBundleManager.assetBundleCache.Unload(false);

        //kuni
        GameObject boardObj = board.transform.FindChild("board").gameObject;

        kuniMap.transform.SetParent(boardObj.transform);
        kuniMap.transform.localScale    = new Vector2(9, 6);
        kuniMap.transform.localPosition = new Vector3(-145, 4, 0);
        kuniMap.name = "kuniMap" + kuniId;


        //Clear Stage Setting
        string clearedStage       = "kuni" + kuniId;
        string clearedStageString = "";

        if (Application.loadedLevelName != "tutorialMain")
        {
            clearedStageString = PlayerPrefs.GetString(clearedStage);
        }
        else
        {
            clearedStageString = "1,2,3,4,5,6,7,8,9,10";
        }
        List <string> clearedStageList = new List <string> ();

        if (clearedStageString != null && clearedStageString != "")
        {
            clearedStageList = new List <string> (clearedStageString.Split(delimiterChars));
        }

        //Data adjustment
        if (!clearFlg && clearedStageList.Count == 10)
        {
            clearedStageList   = new List <string>();
            clearedStageString = "";
            PlayerPrefs.DeleteKey(clearedStage);
        }


        //Default Value
        Entity_stage_mst stageMst = Resources.Load("Data/stage_mst") as Entity_stage_mst;
        int    startline          = 10 * kuniId - 10;
        string stagePath          = "Prefabs/Map/stage/stage";
        string clearedPath        = "Prefabs/Map/cleared";


        int   stageId       = 1;
        bool  clearedFlg    = false;
        int   mySenryoku    = daimyo.getSenryoku(myDaimyoId);
        int   enemySenryoku = daimyo.getSenryoku(daimyoId);
        float senryokuRatio = (float)enemySenryoku / (float)mySenryoku;

        for (int i = startline; i < startline + 10; i++)
        {
            GameObject stage = Instantiate(Resources.Load(stagePath)) as GameObject;
            stage.transform.SetParent(kuniMap.transform);
            stage.transform.localScale = new Vector2(1, 1);
            stage.name = "stage" + stageId.ToString();

            //Cleared Check
            if (clearedStageList.Contains(stageId.ToString()) == true)
            {
                GameObject cleared = Instantiate(Resources.Load(clearedPath)) as GameObject;
                cleared.transform.SetParent(stage.transform);
                stage.GetComponent <ShowStageDtl> ().clearedFlg = true;
                cleared.transform.localScale    = new Vector2(3, 5);
                cleared.transform.localPosition = new Vector2(0, 0);
                clearedFlg   = true;
                cleared.name = "cleared";
            }

            //Get Stage Info
            string stageName = "";
            int    locationX = stageMst.param [i].LocationX;
            int    locationY = stageMst.param [i].LocationY;
            int    powerType = stageMst.param [i].powerTyp;
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                stageName = stageMst.param[i].stageNameEng;
            }
            else
            {
                stageName = stageMst.param[i].stageName;
            }
            RectTransform stageTransform = stage.GetComponent <RectTransform> ();
            stageTransform.anchoredPosition = new Vector3(locationX, locationY, 0);


            //money and exp calculation
            int minExp = getMinExp(powerType, senryokuRatio);
            int maxExp = getMaxExp(powerType, senryokuRatio);
            int exp    = UnityEngine.Random.Range(minExp, maxExp + 1);

            int minMoney = minExp * 2;
            int maxMoney = maxExp * 3;
            int money    = UnityEngine.Random.Range(minMoney, maxMoney + 1);

            string itemGrp = getRandomItemGrp();
            string itemTyp = "";
            int    itemId  = 0;
            int    itemQty = 1;

            if (itemGrp == "item")
            {
                itemTyp = getRandomItemTyp(itemGrp);
                if (itemTyp == "tech")
                {
                    itemId = getItemRank(66, 33);
                }
                else if (itemTyp == "Tama")
                {
                    itemId = getItemRank(20, 5);
                    if (itemId == 3)
                    {
                        itemQty = 100;
                    }
                    else if (itemId == 2)
                    {
                        itemQty = 20;
                    }
                    else if (itemId == 1)
                    {
                        itemQty = 5;
                    }
                }
                else
                {
                    itemId = getItemRank(20, 5);
                }
            }
            else if (itemGrp == "kahou")
            {
                itemTyp = getRandomItemTyp(itemGrp);
                Kahou  kahou     = new Kahou();
                string kahouRank = getKahouRank();
                itemId = kahou.getRamdomKahouId(itemTyp, kahouRank);
            }


            stage.GetComponent <ShowStageDtl> ().kuniId    = kuniId;
            stage.GetComponent <ShowStageDtl> ().stageId   = stageId;
            stage.GetComponent <ShowStageDtl> ().stageName = stageName;
            stage.GetComponent <ShowStageDtl> ().exp       = exp;
            stage.GetComponent <ShowStageDtl> ().showExp   = minExp + " - " + maxExp;
            stage.GetComponent <ShowStageDtl> ().money     = money;
            stage.GetComponent <ShowStageDtl> ().showMoney = minMoney + " - " + maxMoney;
            stage.GetComponent <ShowStageDtl> ().itemGrp   = itemGrp;
            stage.GetComponent <ShowStageDtl> ().itemTyp   = itemTyp;
            stage.GetComponent <ShowStageDtl> ().itemId    = itemId.ToString();
            stage.GetComponent <ShowStageDtl> ().itemQty   = itemQty;
            stage.GetComponent <ShowStageDtl> ().powerType = powerType;

            if (powerType == 2)
            {
                string imagePath = "Prefabs/Naisei/Shiro/Sprite/shiro_m";
                stage.transform.FindChild("shiroImage").GetComponent <SpriteRenderer> ().sprite =
                    Resources.Load(imagePath, typeof(Sprite)) as Sprite;
            }
            else if (powerType == 3)
            {
                string imagePath = "Prefabs/Naisei/Shiro/Sprite/shiro_l";
                stage.transform.FindChild("shiroImage").GetComponent <SpriteRenderer> ().sprite =
                    Resources.Load(imagePath, typeof(Sprite)) as Sprite;
            }



            stageId = stageId + 1;
        }


        //Line Setting
        Entity_stageLink_mst stageLinkMst = Resources.Load("Data/stageLink_mst") as Entity_stageLink_mst;
        List <string>        myStageLink  = new List <string> ();

        for (int i = 0; i < stageLinkMst.param.Count; i++)
        {
            int tempKuniId = stageLinkMst.param[i].kuniId;
            if (tempKuniId == kuniId)
            {
                myStageLink.Add(stageLinkMst.param[i].Link);
            }
        }
        List <string> myOriginalStageLink = new List <string>(myStageLink);

        //Reduce Linkcut kousaku
        string        tempLinkuct = "linkcut" + kuniId;
        string        linkcut     = PlayerPrefs.GetString(tempLinkuct);
        List <string> linkcutList = new List <string> ();

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

        myStageLink.RemoveAll(linkcutList.Contains);



        char[] delimiterChars2 = { '-' };
        string linkPath        = "Prefabs/Map/stage/link";

        for (int j = 0; j < myStageLink.Count; j++)
        {
            List <string> linkList   = new List <string> (myStageLink[j].Split(delimiterChars2));
            string        stage1Name = linkList[0];
            string        stage2Name = linkList[1];

            //if(!clearedStageList.Contains(stage1Name) && !clearedStageList.Contains(stage2Name)){

            //1st
            string        temp1      = "stage" + stage1Name;
            GameObject    stage1     = kuniMap.transform.FindChild(temp1).gameObject;
            RectTransform rectStage1 = stage1.GetComponent <RectTransform>();
            Vector3       vect1      = new Vector3(rectStage1.anchoredPosition.x, rectStage1.anchoredPosition.y, 0);

            //2nd
            string        temp2      = "stage" + stage2Name;
            GameObject    stage2     = kuniMap.transform.FindChild(temp2).gameObject;
            RectTransform rectStage2 = stage2.GetComponent <RectTransform>();
            Vector3       vect2      = new Vector3(rectStage2.anchoredPosition.x, rectStage2.anchoredPosition.y, 0);



            //Set
            GameObject link = Instantiate(Resources.Load(linkPath)) as GameObject;
            link.transform.SetParent(kuniMap.transform);
            link.transform.localScale = new Vector2(1, 1);
            RectTransform linkRectTransform = link.GetComponent <RectTransform>();
            linkRectTransform.anchoredPosition = new Vector3(0, 0, 0);
            link.GetComponent <LineRenderer>().SetPosition(0, vect1);
            link.GetComponent <LineRenderer>().SetPosition(1, vect2);

            if (!clearedStageList.Contains(stage1Name) && !clearedStageList.Contains(stage2Name))
            {
                //Line No
                stage1.GetComponent <ShowStageDtl>().linkNo = stage1.GetComponent <ShowStageDtl>().linkNo + 1;
                stage2.GetComponent <ShowStageDtl>().linkNo = stage2.GetComponent <ShowStageDtl>().linkNo + 1;
            }

            //Name
            link.name = "link" + stage1Name + "-" + stage2Name;
        }


        //Battle Initial Setting
        StartKassen sk = GameObject.Find("BattleButton").GetComponent <StartKassen> ();

        sk.activeBusyoQty = activeBusyoQty;
        sk.activeBusyoLv  = activeBusyoLv;
        sk.activeButaiQty = activeButaiQty;
        sk.activeButaiLv  = activeButaiLv;
        sk.activeDaimyoId = daimyoId;
        sk.doumeiFlg      = doumeiFlg;

        /*Naisei Button*/
        string        seiryoku     = PlayerPrefs.GetString("seiryoku");
        List <string> seiryokuList = new List <string>();

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

        //Only for all clear
        if (clearFlg)
        {
            string     naiseiPath = "Prefabs/Map/NaiseiButton";
            GameObject naiseiBtn  = Instantiate(Resources.Load(naiseiPath)) as GameObject;
            naiseiBtn.transform.SetParent(board.transform);
            naiseiBtn.GetComponent <StartNaisei> ().activeKuniId   = kuniId;
            naiseiBtn.GetComponent <StartNaisei> ().activeKuniName = kuniName;
            naiseiBtn.GetComponent <StartNaisei> ().clearedFlg     = clearedFlg;
            naiseiBtn.transform.localScale    = new Vector2(0.4f, 0.4f);
            naiseiBtn.transform.localPosition = new Vector2(-490, -300);
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                boardObj.transform.FindChild("stageDtl").transform.FindChild("BattleButton").transform.FindChild("Text").GetComponent <Text> ().text = "Training";
            }
            else
            {
                boardObj.transform.FindChild("stageDtl").transform.FindChild("BattleButton").transform.FindChild("Text").GetComponent <Text>().text = "訓練";
            }
            GameObject firstStage = GameObject.Find("stage1");
            firstStage.GetComponent <ShowStageDtl>().OnClick();

            if (Application.loadedLevelName == "tutorialMain")
            {
                GameObject battleBtnObj = boardObj.transform.FindChild("stageDtl").transform.FindChild("BattleButton").gameObject;
                battleBtnObj.GetComponent <Button>().interactable = false;
                battleBtnObj.transform.FindChild("Text").GetComponent <Text>().color = new Color(220f / 255f, 190f / 255f, 40f / 255f, 100f / 255f);

                TutorialController tutorialScript = new TutorialController();
                Vector2            vect           = new Vector2(0, 100);
                GameObject         animObj        = tutorialScript.SetPointer(naiseiBtn, vect);
                animObj.transform.localScale = new Vector2(300, 300);
            }
        }
        else
        {
            //enemy attack

            GameObject        closeObj   = boardObj.transform.FindChild("close").gameObject;
            EnemyEventHandler enemyEvent = board.transform.FindChild("board").GetComponent <EnemyEventHandler>();
            enemyEvent.doEnemyEvent(kuniMap, closeObj, kuniId, daimyoId, activeBusyoQty, activeBusyoLv, activeButaiQty, activeButaiLv);

            //open shiro
            List <int> closeStageIdList = new List <int> {
                1, 2, 3, 4, 5, 6, 7, 8, 9, 10
            };

            //compare linkKuni with mySeiryoku
            List <int> linkKuniList   = new List <int>();
            List <int> linkMyKuniList = new List <int>();

            KuniInfo kuniScript = new KuniInfo();
            linkKuniList = kuniScript.getMappingKuni(kuniId);
            for (int i = 0; i < linkKuniList.Count; i++)
            {
                int linkKuniId = linkKuniList[i];
                if (seiryokuList[linkKuniId - 1] == myDaimyoId.ToString())
                {
                    linkMyKuniList.Add(linkKuniId);
                }
            }

            //open initial stage
            for (int j = 0; j < linkMyKuniList.Count; j++)
            {
                int    srcKuniId = linkMyKuniList[j];
                string linkStage = kuniScript.getLinkStage(srcKuniId, kuniId);
                linkStage = linkStage.Replace("stage", "");
                List <int> linkStageList = new List <int>(Array.ConvertAll(linkStage.Split(','),
                                                                           new Converter <string, int>((s) => { return(Convert.ToInt32(s)); })));
                closeStageIdList.RemoveAll(linkStageList.Contains);
            }


            //open cleared kuni & linked stage
            List <int> clearedStageIntList = clearedStageList.ConvertAll(x => int.Parse(x));
            closeStageIdList.RemoveAll(clearedStageIntList.Contains);
            for (int l = 0; l < clearedStageIntList.Count; l++)
            {
                int srcStageId = clearedStageIntList[l];

                for (int m = 0; m < myOriginalStageLink.Count; m++)
                {
                    List <string> linkList = new List <string>(myOriginalStageLink[m].Split(delimiterChars2));
                    int           stage1Id = int.Parse(linkList[0]);
                    int           stage2Id = int.Parse(linkList[1]);
                    if (srcStageId == stage1Id)
                    {
                        if (!getStageGunzeiExistFlg(stage1Id, stage2Id))
                        {
                            closeStageIdList.Remove(stage2Id);
                        }
                    }
                    else if (srcStageId == stage2Id)
                    {
                        if (!getStageGunzeiExistFlg(stage2Id, stage1Id))
                        {
                            closeStageIdList.Remove(stage1Id);
                        }
                    }
                }
            }


            Color closeColor = new Color(60f / 255f, 60f / 255f, 60f / 255f, 255f / 255f); //Black
            for (int k = 0; k < closeStageIdList.Count; k++)
            {
                int        closeStageId  = closeStageIdList[k];
                string     stageName     = "stage" + closeStageId.ToString();
                GameObject closeStageObj = kuniMap.transform.FindChild(stageName).gameObject;
                closeStageObj.GetComponent <Button>().enabled = false;
                closeStageObj.transform.FindChild("shiroImage").GetComponent <SpriteRenderer>().color = closeColor;
            }


            //Initial Setting
            int initStageId = 1;
            for (int i = 1; i <= 10; i++)
            {
                if (!closeStageIdList.Contains(i))
                {
                    initStageId = i;
                }
            }

            string     initStageName = "stage" + initStageId.ToString();
            GameObject firstStage    = GameObject.Find(initStageName);
            firstStage.GetComponent <ShowStageDtl>().OnClick();
        }

        //Kousaku
        if (!clearFlg)
        {
            string     pathOfScroll = "Prefabs/Map/kousaku/BusyoSelectScroll";
            GameObject scroll       = Instantiate(Resources.Load(pathOfScroll)) as GameObject;
            scroll.transform.SetParent(board.transform);
            scroll.transform.localScale = new Vector2(1, 1);
            RectTransform rectScroll = scroll.GetComponent <RectTransform> ();
            rectScroll.anchoredPosition3D = new Vector3(410, 0, 0);
            rectScroll.sizeDelta          = new Vector2(300, 750);
            scroll.name = "BusyoSelectScroll";
            scroll.SetActive(false);

            KousakuConfirm kousakuScript = GameObject.Find("LinkCutButton").GetComponent <KousakuConfirm> ();
            kousakuScript.cyouhouSnbRankId = cyouhouSnbRankId;
            kousakuScript.scrollObj        = scroll;

            KousakuConfirm kousakuScript2 = GameObject.Find("CyouryakuButton").GetComponent <KousakuConfirm> ();
            kousakuScript2.cyouhouSnbRankId = cyouhouSnbRankId;
            kousakuScript2.scrollObj        = scroll;
        }
        else
        {
            GameObject LinkCutButton = GameObject.Find("LinkCutButton").gameObject;
            LinkCutButton.GetComponent <Button> ().interactable = false;
            LinkCutButton.transform.FindChild("Text").GetComponent <Text> ().color = new Color(220f / 255f, 190f / 255f, 40f / 255f, 100f / 255f);

            GameObject CyouryakuButton = GameObject.Find("CyouryakuButton").gameObject;
            CyouryakuButton.GetComponent <Button> ().interactable = false;
            CyouryakuButton.transform.FindChild("Text").GetComponent <Text> ().color = new Color(220f / 255f, 190f / 255f, 40f / 255f, 100f / 255f);
        }


        /*Kassen Event Controller Start*/
        KassenEvent kEvent = new KassenEvent();

        kEvent.MakeEvent(clearFlg, kuniId, kuniMap, daimyoId);

        viewKuniLink(board, kuniMap, seiryokuList);

        /*Kassen Event Controller End*/
    }