Esempio n. 1
0
	public void wasAttacked(string key, int srcKuni, int dstKuni, int srcDaimyoId, int dstDaimyoId, bool dstEngunFlg, string dstEngunDaimyoId, string dstEngunSts){

		//In the case of My Damyo was Attacked

		//For Dramatic Enemy Creation
		GameObject kuniView = GameObject.Find("KuniIconView");
		SendParam param = kuniView.transform.FindChild(srcKuni.ToString()).GetComponent<SendParam>();
		int busyoQty = param.busyoQty;
		int busyoLv = param.busyoLv;
		int butaiQty = param.butaiQty;
		int butaiLv = param.butaiLv;

		//Dummy
		PlayerPrefs.SetInt("activeStageId", 0);
		PlayerPrefs.SetInt("activeStageMoney", busyoQty*busyoLv*100);
		PlayerPrefs.SetInt("activeStageExp", busyoQty*busyoLv*10);
		PlayerPrefs.SetString("activeItemType", "");
		PlayerPrefs.SetInt("activeItemId", 0);
		PlayerPrefs.SetFloat("activeItemRatio", 0);
		PlayerPrefs.SetInt("activeItemQty", 0);
		
		//Actual
		PlayerPrefs.SetInt("activeKuniId", dstKuni);
		PlayerPrefs.SetInt("activeDaimyoId", srcDaimyoId);
		PlayerPrefs.SetInt ("activeBusyoQty", busyoQty);
		PlayerPrefs.SetInt ("activeBusyoLv", busyoLv);
		PlayerPrefs.SetInt ("activeButaiQty", butaiQty);
		PlayerPrefs.SetInt ("activeButaiLv", butaiLv);

		//Passive only
		PlayerPrefs.SetBool ("isAttackedFlg", true);
		PlayerPrefs.SetString("activeKey", key);
		PlayerPrefs.SetInt("activeSrcDaimyoId", srcDaimyoId);
		PlayerPrefs.SetInt("activeDstDaimyoId", dstDaimyoId);

		//Engun
		if (dstEngunFlg) {

			PlayerPrefs.SetString("playerEngunList", dstEngunSts);
			PlayerPrefs.DeleteKey("enemyEngunList");

		} else {
			PlayerPrefs.DeleteKey("playerEngunList");
			PlayerPrefs.DeleteKey("enemyEngunList");
		}

		//Gaikou Down
		Gaikou gaikou = new Gaikou ();
		gaikou.downGaikouByAttack (srcDaimyoId, dstDaimyoId);

		PlayerPrefs.Flush();
		Application.LoadLevel("kassen");


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

		//Hyourou Check
		int nowHyourou = PlayerPrefs.GetInt ("hyourou");

		if(nowHyourou >=5 ){

			//Now on Kuni & Stage
			PlayerPrefs.SetInt("activeKuniId", activeKuniId);
			PlayerPrefs.SetInt("activeStageId", activeStageId);

			//What we can get
			PlayerPrefs.SetInt("activeStageMoney", activeStageMoney);
			PlayerPrefs.SetInt("activeStageExp", activeStageExp);
			PlayerPrefs.SetString("activeItemType", activeItemType);
			PlayerPrefs.SetInt("activeItemId", activeItemId);
			PlayerPrefs.SetFloat("activeItemRatio", activeItemRatio);
			PlayerPrefs.SetInt("activeItemQty", activeItemQty);

			//For Dramatic Enemy Creation
			PlayerPrefs.SetInt("activeDaimyoId", activeDaimyoId);
			PlayerPrefs.SetInt ("activeBusyoQty", activeBusyoQty);
			PlayerPrefs.SetInt ("activeBusyoLv", activeBusyoLv);
			PlayerPrefs.SetInt ("activeButaiQty", activeButaiQty);
			PlayerPrefs.SetInt ("activeButaiLv", activeButaiLv);

			//Hyourou
			int newHyourou = nowHyourou - 5;
			PlayerPrefs.SetInt("hyourou", newHyourou);

			//Gaikou
			int myDaimyo = PlayerPrefs.GetInt ("myDaimyo");
			Gaikou gaikou = new Gaikou ();
			gaikou.downGaikouByAttack (myDaimyo, activeDaimyoId);

			//Reverse Flag
			PlayerPrefs.DeleteKey ("isAttackedFlg");

			//Player Doumei Flg
			PlayerPrefs.DeleteKey("playerEngunList");

			//Enemy Doumei Handling
			string doumeiTemp = "doumei" + activeDaimyoId;
			string enemyDoumeiString = PlayerPrefs.GetString (doumeiTemp);
			char[] delimiterChars = {','};
			List<string> doumeiList = new List<string>();
			if(enemyDoumeiString != null && enemyDoumeiString !=""){
				if(enemyDoumeiString.Contains(",")){
					doumeiList = new List<string> (enemyDoumeiString.Split (delimiterChars));
				}else{
					doumeiList.Add(enemyDoumeiString);
				}
			}
			string seiryoku = PlayerPrefs.GetString ("seiryoku");
			List<string> seiryokuList = new List<string> ();
			seiryokuList = new List<string> (seiryoku.Split (delimiterChars));

			Doumei doumei = new Doumei();
			List<string> okDaimyoList = new List<string> ();
			List<string> checkedList = new List<string> ();
			string dstEngunDaimyoId = "";
			string dstEngunSts = ""; //BusyoId-BusyoLv-ButaiQty-ButaiLv:

			okDaimyoList = doumei.traceNeighborDaimyo(activeKuniId, activeDaimyoId, doumeiList, seiryokuList, checkedList, okDaimyoList);
			if(okDaimyoList.Count !=0){
				for(int k=0; k<okDaimyoList.Count; k++){
					string engunDaimyo = okDaimyoList[k];
					int yukoudo = gaikou.getExistGaikouValue(int.Parse(engunDaimyo), activeDaimyoId);
					
					//engun check
					MainEventHandler main = new MainEventHandler();
					bool dstEngunFlg = main.CheckByProbability (yukoudo);
					if(dstEngunFlg){
						//Engun OK
						dstEngunFlg = true;
						if(dstEngunDaimyoId !=null && dstEngunDaimyoId !=""){
							dstEngunDaimyoId = dstEngunDaimyoId + ":" + engunDaimyo;
							string tempEngunSts = main.getEngunSts(engunDaimyo);
							dstEngunSts = dstEngunSts + ":" + tempEngunSts;
							
						}else{
							dstEngunDaimyoId = engunDaimyo;
							string tempEngunSts = main.getEngunSts(engunDaimyo);
							dstEngunSts = tempEngunSts;
							
						}
					}
				}
				PlayerPrefs.SetString("enemyEngunList", dstEngunSts);

			}


			//Kyoutou Handling

			PlayerPrefs.DeleteKey("tempKyoutouList");
			string tempKyoutouList = "";

			char[] delimiterChars2 = {':'};
			char[] delimiterChars3 = {'-'};
			List<string> unitList = new List<string> ();
			string nextKyoutouList = "";
			string playerKyoutouList = PlayerPrefs.GetString("playerKyoutouList","");
			if(playerKyoutouList !=null && playerKyoutouList != ""){
				if(playerKyoutouList.Contains(":")){
					unitList = new List<string> (playerKyoutouList.Split (delimiterChars2));
				}else{
					unitList.Add(playerKyoutouList);
				}
				List<string> unit2List = new List<string> ();
				for(int i=0; i<unitList.Count; i++){
					string playerKyoutouList2 = unitList[i];
					unit2List = new List<string> (playerKyoutouList2.Split (delimiterChars3));

					string tempString = unit2List[1] + "-" + unit2List[2]+ "-" + unit2List[3]+ "-" + unit2List[4];
					if(unit2List[0] == activeKuniId.ToString()){
						if(tempKyoutouList != null && tempKyoutouList != ""){
							tempKyoutouList = tempKyoutouList + ":" + tempString;
						}else{
							tempKyoutouList = tempString;
						}
					}else{
						if(nextKyoutouList != "" && nextKyoutouList != null){
							nextKyoutouList = nextKyoutouList + ":" + tempString;
						}else{
							nextKyoutouList = tempString;
						}
					}
				}
			}

			PlayerPrefs.SetString("tempKyoutouList",tempKyoutouList);
			PlayerPrefs.SetString("playerKyoutouList",nextKyoutouList);

			PlayerPrefs.Flush();
			Application.LoadLevel("kassen");


		}else{

			//Error Message
			Message msg = new Message();
			string Text = "兵糧が不足しておりますぞ。";
			msg.makeMessageOnBoard(Text);

		}
	}
Esempio n. 3
0
    public void attack()
    {
        audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();

        //Same Daimyo Check
        int        latestDaimyoId = kuniIconView.transform.FindChild(dstKuni.ToString()).GetComponent <SendParam> ().daimyoId;
        GameObject MsgBack        = this.transform.FindChild("MsgBack").gameObject;
        GameObject MsgText        = MsgBack.transform.FindChild("MsgText").gameObject;

        if (dstDaimyoId == latestDaimyoId)
        {
            if (dstDaimyoId != myDaimyoId)
            {
                audioSources [7].Play();

                int enemyHei = heiryokuCalc(dstKuni);

                //Engun
                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;
                if ((myHei + enemyHei) != 0)
                {
                    ratio = 100 * myHei / (myHei + enemyHei);
                    if (ratio < 1)
                    {
                        ratio = 1;
                    }
                }

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

                //Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst;
                KuniInfo kuniScript  = new KuniInfo();
                string   dstKuniName = kuniScript.getKuniName(dstKuni);

                //Gaikou
                Gaikou gaikou = new Gaikou();
                gaikou.downGaikouByAttack(srcDaimyoId, dstDaimyoId);

                if (winFlg)
                {
                    bool   noGunzeiFlg = false;
                    string syouhai     = "";
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        syouhai = srcDaimyoName + "\n" + "Conquered " + dstKuniName;
                    }
                    else
                    {
                        syouhai = srcDaimyoName + "\n" + dstKuniName + "を攻略";
                    }
                    MsgBack.GetComponent <Image> ().enabled = true;
                    MsgText.GetComponent <Text> ().enabled  = true;
                    MsgText.GetComponent <Text> ().text     = syouhai;

                    win(key, srcDaimyoId, dstDaimyoId, noGunzeiFlg, dstKuni);

                    fire(dstKuni);
                }
                else
                {
                    string syouhai = "";
                    if (Application.systemLanguage != SystemLanguage.Japanese)
                    {
                        syouhai = dstDaimyoName + "\n" + "Defended " + dstKuniName;
                    }
                    else
                    {
                        syouhai = dstDaimyoName + "\n" + dstKuniName + "を防衛";
                    }
                    MsgBack.GetComponent <Image> ().enabled = true;
                    MsgText.GetComponent <Text> ().enabled  = true;
                    MsgText.GetComponent <Text> ().text     = syouhai;

                    gameObject.GetComponent <GunzeiFadeOut> ().enabled = true;

                    MainStageController main = new MainStageController();
                    main.deleteKeyHistory(key);
                }
            }
            else
            {
                MyDaimyoWasAttacked atked = new MyDaimyoWasAttacked();
                atked.wasAttacked(key, srcKuni, dstKuni, srcDaimyoId, dstDaimyoId, dstEngunFlg, dstEngunDaimyoId, dstEngunSts);
            }
        }
        else
        {
            audioSources [1].Play();
            string syouhai = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                syouhai = srcDaimyoName + " withdrawed";
            }
            else
            {
                syouhai = srcDaimyoName + "撤退";
            }
            MsgBack.GetComponent <Image> ().enabled = true;
            MsgText.GetComponent <Text> ().enabled  = true;
            MsgText.GetComponent <Text> ().text     = syouhai;

            gameObject.GetComponent <GunzeiFadeOut> ().enabled = true;

            MainStageController main = new MainStageController();
            main.deleteKeyHistory(key);
        }
    }
Esempio n. 4
0
	public void attack(){

		//Same Daimyo Check
		int latestDaimyoId = kuniIconView.transform.FindChild (dstKuni.ToString ()).GetComponent<SendParam> ().daimyoId;
		GameObject MsgBack = this.transform.FindChild ("MsgBack").gameObject;
		GameObject MsgText = MsgBack.transform.FindChild ("MsgText").gameObject;

		if (dstDaimyoId == latestDaimyoId) {
		
			if (dstDaimyoId != myDaimyoId) {
				int enemyHei = heiryokuCalc (dstKuni);

				//Engun
				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;
				if ((myHei + enemyHei) != 0) {
					ratio = 100 * myHei / (myHei + enemyHei);
					if (ratio < 1) {
						ratio = 1;
					}	
				}

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

				Entity_kuni_mst kuniMst = Resources.Load ("Data/kuni_mst") as Entity_kuni_mst;
				string dstKuniName = kuniMst.param [dstKuni - 1].kuniName;

				//Gaikou
				Gaikou gaikou = new Gaikou();
				gaikou.downGaikouByAttack(srcDaimyoId,dstDaimyoId);

				if (winFlg) {
					bool noGunzeiFlg = false;
					string syouhai = srcDaimyoName + "\t" + dstKuniName + "を攻略";
					MsgBack.GetComponent<Image> ().enabled = true;
					MsgText.GetComponent<Text> ().enabled = true;
					MsgText.GetComponent<Text> ().text = syouhai;
					if (leftFlg == true) {
						MsgText.transform.localScale = new Vector2 (-0.12f, 0.17f);
					}

					win (key, srcDaimyoId, dstDaimyoId, noGunzeiFlg);

				} else {
					string syouhai = dstDaimyoName + "\t" + dstKuniName + "を防衛";
					MsgBack.GetComponent<Image> ().enabled = true;
					MsgText.GetComponent<Text> ().enabled = true;
					MsgText.GetComponent<Text> ().text = syouhai;
					if (leftFlg == true) {
						MsgText.transform.localScale = new Vector2 (-0.12f, 0.17f);
					}
					gameObject.GetComponent<GunzeiFadeOut> ().enabled = true;

					MainStageController main = new MainStageController ();
					main.deleteKeyHistory (key);
				}
			
			} else {
				MyDaimyoWasAttacked atked = new MyDaimyoWasAttacked ();
				atked.wasAttacked (key, srcKuni, dstKuni, srcDaimyoId, dstDaimyoId, dstEngunFlg, dstEngunDaimyoId, dstEngunSts);
			}
		} else {

			string syouhai = srcDaimyoName + "撤退";
			MsgBack.GetComponent<Image> ().enabled = true;
			MsgText.GetComponent<Text> ().enabled = true;
			MsgText.GetComponent<Text> ().text = syouhai;
			if (leftFlg == true) {
				MsgText.transform.localScale = new Vector2 (-0.12f, 0.17f);
			}
			gameObject.GetComponent<GunzeiFadeOut> ().enabled = true;
			
			MainStageController main = new MainStageController ();
			main.deleteKeyHistory (key);
		}
	}
Esempio n. 5
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource> ();
        Message       msg          = new Message();

        if (!checkJinkeiAvailable())
        {
            audioSources[4].Play();
            msg.makeUpperMessageOnBoard(msg.getMessage(133));
        }
        else
        {
            //Hyourou Check
            int nowHyourou = PlayerPrefs.GetInt("hyourou");

            if (nowHyourou >= 5)
            {
                audioSources [5].Play();

                //Now on Kuni & Stage
                PlayerPrefs.SetInt("activeKuniId", activeKuniId);
                PlayerPrefs.SetInt("activeStageId", activeStageId);
                PlayerPrefs.SetString("activeStageName", activeStageName);

                //What we can get
                PlayerPrefs.SetInt("activeStageMoney", activeStageMoney);
                PlayerPrefs.SetInt("activeStageExp", activeStageExp);
                PlayerPrefs.SetString("activeItemGrp", activeItemGrp);
                PlayerPrefs.SetString("activeItemType", activeItemType);
                PlayerPrefs.SetInt("activeItemId", activeItemId);
                PlayerPrefs.SetInt("activeItemQty", activeItemQty);

                //For Dramatic Enemy Creation
                PlayerPrefs.SetInt("activeDaimyoId", activeDaimyoId);
                PlayerPrefs.SetInt("activeBusyoQty", activeBusyoQty);
                PlayerPrefs.SetInt("activeBusyoLv", activeBusyoLv);
                PlayerPrefs.SetInt("activeButaiQty", activeButaiQty);
                PlayerPrefs.SetInt("activeButaiLv", activeButaiLv);

                //Gaikou
                int    myDaimyo = PlayerPrefs.GetInt("myDaimyo");
                Gaikou gaikou   = new Gaikou();
                gaikou.downGaikouByAttack(myDaimyo, activeDaimyoId);

                //Reverse Flag
                PlayerPrefs.DeleteKey("isAttackedFlg");
                PlayerPrefs.DeleteKey("isKessenFlg");

                //Player Doumei Flg
                PlayerPrefs.DeleteKey("playerEngunList");

                //Enemy Doumei Handling
                PlayerPrefs.DeleteKey("enemyEngunList");
                string        doumeiTemp        = "doumei" + activeDaimyoId;
                string        enemyDoumeiString = PlayerPrefs.GetString(doumeiTemp);
                char[]        delimiterChars    = { ',' };
                List <string> doumeiList        = new List <string>();
                if (enemyDoumeiString != null && enemyDoumeiString != "")
                {
                    if (enemyDoumeiString.Contains(","))
                    {
                        doumeiList = new List <string> (enemyDoumeiString.Split(delimiterChars));
                    }
                    else
                    {
                        doumeiList.Add(enemyDoumeiString);
                    }
                }
                string        seiryoku     = PlayerPrefs.GetString("seiryoku");
                List <string> seiryokuList = new List <string> ();
                seiryokuList = new List <string> (seiryoku.Split(delimiterChars));

                Doumei        doumei           = new Doumei();
                List <string> okDaimyoList     = new List <string> ();
                List <string> checkedList      = new List <string> ();
                string        dstEngunDaimyoId = "";
                string        dstEngunSts      = ""; //BusyoId-BusyoLv-ButaiQty-ButaiLv:

                okDaimyoList = doumei.traceNeighborDaimyo(activeKuniId, activeDaimyoId, doumeiList, seiryokuList, checkedList, okDaimyoList);

                if (okDaimyoList.Count != 0)
                {
                    for (int k = 0; k < okDaimyoList.Count; k++)
                    {
                        string engunDaimyo = okDaimyoList[k];
                        int    yukoudo     = gaikou.getExistGaikouValue(int.Parse(engunDaimyo), activeDaimyoId);

                        //mydaimyo doumei check
                        bool myDoumeiFlg = false;
                        myDoumeiFlg = doumei.myDoumeiExistCheck(int.Parse(engunDaimyo));
                        if (myDoumeiFlg)
                        {
                            yukoudo = yukoudo / 2;
                        }

                        //engun check
                        MainEventHandler main        = new MainEventHandler();
                        bool             dstEngunFlg = main.CheckByProbability(yukoudo);
                        if (dstEngunFlg)
                        {
                            //Engun OK
                            dstEngunFlg = true;
                            if (dstEngunDaimyoId != null && dstEngunDaimyoId != "")
                            {
                                dstEngunDaimyoId = dstEngunDaimyoId + ":" + engunDaimyo;
                                string tempEngunSts = main.getEngunSts(engunDaimyo);
                                dstEngunSts = dstEngunSts + ":" + engunDaimyo + "-" + tempEngunSts;
                            }
                            else
                            {
                                dstEngunDaimyoId = engunDaimyo;
                                string tempEngunSts = main.getEngunSts(engunDaimyo);
                                dstEngunSts = engunDaimyo + "-" + tempEngunSts;
                            }
                        }
                    }
                    PlayerPrefs.SetString("enemyEngunList", dstEngunSts);
                }


                //Kyoutou Handling

                PlayerPrefs.DeleteKey("tempKyoutouList");
                string tempKyoutouList = "";

                char[]        delimiterChars2   = { ':' };
                char[]        delimiterChars3   = { '-' };
                List <string> unitList          = new List <string> ();
                string        nextKyoutouList   = "";
                string        playerKyoutouList = PlayerPrefs.GetString("playerKyoutouList", "");
                if (playerKyoutouList != null && playerKyoutouList != "")
                {
                    if (playerKyoutouList.Contains(":"))
                    {
                        unitList = new List <string> (playerKyoutouList.Split(delimiterChars2));
                    }
                    else
                    {
                        unitList.Add(playerKyoutouList);
                    }
                    List <string> unit2List = new List <string> ();
                    for (int i = 0; i < unitList.Count; i++)
                    {
                        string playerKyoutouList2 = unitList[i];
                        unit2List = new List <string> (playerKyoutouList2.Split(delimiterChars3));

                        string tempString = unit2List[0] + "-" + unit2List[1] + "-" + unit2List[2] + "-" + unit2List[3] + "-" + unit2List[4];
                        if (unit2List[0] == activeKuniId.ToString())
                        {
                            if (tempKyoutouList != null && tempKyoutouList != "")
                            {
                                tempKyoutouList = tempKyoutouList + ":" + tempString;
                            }
                            else
                            {
                                tempKyoutouList = tempString;
                            }
                        }
                        else
                        {
                            if (nextKyoutouList != "" && nextKyoutouList != null)
                            {
                                nextKyoutouList = nextKyoutouList + ":" + tempString;
                            }
                            else
                            {
                                nextKyoutouList = tempString;
                            }
                        }
                    }
                }

                PlayerPrefs.SetString("tempKyoutouList", tempKyoutouList);
                PlayerPrefs.SetString("playerKyoutouList", nextKyoutouList);


                //Power Keisu
                PlayerPrefs.DeleteKey("activeLink");
                PlayerPrefs.DeleteKey("activePowerType");
                PlayerPrefs.SetInt("activeLink", linkNo);

                //Power Type Config
                if (powerType == 1)
                {
                    int rdm = UnityEngine.Random.Range(0, 3); //1:happen, 0,2:not happen
                    if (rdm == 1)
                    {
                        powerType = 2;
                    }
                }
                else if (powerType == 2)
                {
                    int rdm = UnityEngine.Random.Range(0, 3); //1:happen, 0,2:not happen
                    if (rdm == 1)
                    {
                        powerType = 3;
                    }
                }



                PlayerPrefs.SetInt("activePowerType", powerType);

                PlayerPrefs.Flush();
                //Stop BGM
                GameObject.Find("BGMController").GetComponent <DontDestroySoundOnLoad> ().DestoryFlg = true;

                Stage stage      = new Stage();
                int   stageMapId = stage.getStageMap(activeKuniId, activeStageId);

                if (stageMapId != 4)
                {
                    Application.LoadLevel("preKassen");
                }
                else
                {
                    Application.LoadLevel("preKaisen");
                }
            }
            else
            {
                //Error Message
                audioSources [4].Play();

                msg.hyourouMovieMessage();
            }
        }
    }
    public void wasAttacked(string key, int srcKuni, int dstKuni, int srcDaimyoId, int dstDaimyoId, bool dstEngunFlg, string dstEngunDaimyoId, string dstEngunSts)
    {
        //In the case of My Damyo was Attacked

        //For Dramatic Enemy Creation
        GameObject kuniView = GameObject.Find("KuniIconView");

        if (kuniView.transform.FindChild(srcKuni.ToString()))
        {
            SendParam param    = kuniView.transform.FindChild(srcKuni.ToString()).GetComponent <SendParam> ();
            int       busyoQty = param.busyoQty;
            int       busyoLv  = param.busyoLv;
            int       butaiQty = param.butaiQty;
            int       butaiLv  = param.butaiLv;

            //Dummy
            PlayerPrefs.SetInt("activeStageId", 0);
            PlayerPrefs.SetInt("activeStageMoney", busyoQty * 500);
            PlayerPrefs.SetInt("activeStageExp", busyoQty * 100);
            PlayerPrefs.SetString("activeItemType", "");
            PlayerPrefs.SetInt("activeItemId", 0);
            PlayerPrefs.SetFloat("activeItemRatio", 0);
            PlayerPrefs.SetInt("activeItemQty", 0);

            //Actual
            PlayerPrefs.SetInt("activeKuniId", dstKuni);
            KuniInfo kuni       = new KuniInfo();
            string   kuniName   = kuni.getKuniName(dstKuni);
            string   kassenName = "";
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                kassenName = kuniName + " Defence";
            }
            else
            {
                kassenName = kuniName + "防衛";
            }
            PlayerPrefs.SetString("activeStageName", kassenName);

            PlayerPrefs.SetInt("activeDaimyoId", srcDaimyoId);
            PlayerPrefs.SetInt("activeBusyoQty", busyoQty);
            PlayerPrefs.SetInt("activeBusyoLv", busyoLv);
            PlayerPrefs.SetInt("activeButaiQty", butaiQty);
            PlayerPrefs.SetInt("activeButaiLv", butaiLv);

            //Passive only
            PlayerPrefs.SetBool("isAttackedFlg", true);
            PlayerPrefs.DeleteKey("isKessenFlg");
            PlayerPrefs.SetString("activeKey", key);
            PlayerPrefs.SetInt("activeSrcDaimyoId", srcDaimyoId);
            PlayerPrefs.SetInt("activeDstDaimyoId", dstDaimyoId);

            //Engun
            if (dstEngunFlg)
            {
                PlayerPrefs.SetString("playerEngunList", dstEngunSts);
                PlayerPrefs.DeleteKey("enemyEngunList");
            }
            else
            {
                PlayerPrefs.DeleteKey("playerEngunList");
                PlayerPrefs.DeleteKey("enemyEngunList");
            }

            //Gaikou Down
            Gaikou gaikou = new Gaikou();
            gaikou.downGaikouByAttack(srcDaimyoId, dstDaimyoId);

            //Delete "Start Kassen Flg"
            PlayerPrefs.DeleteKey("activeLink");
            PlayerPrefs.DeleteKey("activePowerType");

            List <int> powerTypeList = new List <int> ()
            {
                1, 2, 3
            };
            int random = UnityEngine.Random.Range(1, powerTypeList.Count + 1);
            PlayerPrefs.SetInt("activePowerType", random);


            //Boubi effect
            string boubiTmp = "boubi" + dstKuni.ToString();
            int    boubi    = PlayerPrefs.GetInt(boubiTmp, 0);
            boubi = boubi / 10;
            PlayerPrefs.SetInt("activeBoubi", boubi);



            PlayerPrefs.Flush();
            Application.LoadLevel("preKassen");
        }
    }
Esempio n. 7
0
	public void wasAttacked(string key, int srcKuni, int dstKuni, int srcDaimyoId, int dstDaimyoId, bool dstEngunFlg, string dstEngunDaimyoId, string dstEngunSts){

		//In the case of My Damyo was Attacked

		//For Dramatic Enemy Creation
		GameObject kuniView = GameObject.Find("KuniIconView");
		SendParam param = kuniView.transform.FindChild(srcKuni.ToString()).GetComponent<SendParam>();
		int busyoQty = param.busyoQty;
		int busyoLv = param.busyoLv;
		int butaiQty = param.butaiQty;
		int butaiLv = param.butaiLv;

		//Dummy
		PlayerPrefs.SetInt("activeStageId", 0);
		PlayerPrefs.SetInt("activeStageMoney", busyoQty*busyoLv*100);
		PlayerPrefs.SetInt("activeStageExp", busyoQty*busyoLv*10);
		PlayerPrefs.SetString("activeItemType", "");
		PlayerPrefs.SetInt("activeItemId", 0);
		PlayerPrefs.SetFloat("activeItemRatio", 0);
		PlayerPrefs.SetInt("activeItemQty", 0);
		
		//Actual
		PlayerPrefs.SetInt("activeKuniId", dstKuni);
		KuniInfo kuni = new KuniInfo ();
		string kuniName = kuni.getKuniName (dstKuni);
		string kassenName = kuniName + "防衛";
		PlayerPrefs.SetString("activeStageName", kassenName);

		PlayerPrefs.SetInt("activeDaimyoId", srcDaimyoId);
		PlayerPrefs.SetInt ("activeBusyoQty", busyoQty);
		PlayerPrefs.SetInt ("activeBusyoLv", busyoLv);
		PlayerPrefs.SetInt ("activeButaiQty", butaiQty);
		PlayerPrefs.SetInt ("activeButaiLv", butaiLv);

		//Passive only
		PlayerPrefs.SetBool ("isAttackedFlg", true);
		PlayerPrefs.SetString("activeKey", key);
		PlayerPrefs.SetInt("activeSrcDaimyoId", srcDaimyoId);
		PlayerPrefs.SetInt("activeDstDaimyoId", dstDaimyoId);

		//Engun
		if (dstEngunFlg) {
			PlayerPrefs.SetString("playerEngunList", dstEngunSts);
			PlayerPrefs.DeleteKey("enemyEngunList");

		} else {
			PlayerPrefs.DeleteKey("playerEngunList");
			PlayerPrefs.DeleteKey("enemyEngunList");
		}

		//Gaikou Down
		Gaikou gaikou = new Gaikou ();
		gaikou.downGaikouByAttack (srcDaimyoId, dstDaimyoId);

		//Delete "Start Kassen Flg"
		PlayerPrefs.DeleteKey("activeLink");
		PlayerPrefs.DeleteKey("activePowerType");

		List<int> powerTypeList = new List<int> (){1,2,3};
		int random = UnityEngine.Random.Range(1,powerTypeList.Count + 1);
		PlayerPrefs.SetInt("activePowerType",random);


		//Boubi effect
		string boubiTmp = "boubi" + dstKuni.ToString();
		int boubi = PlayerPrefs.GetInt (boubiTmp,0);
		boubi = boubi / 10;
		PlayerPrefs.SetInt("activeBoubi", boubi);



		PlayerPrefs.Flush();
		Application.LoadLevel("preKassen");


	}