Beispiel #1
0
    public int[] gacyaMoney()
    {
        int[] hitBusyo = new int[3];

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

        Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;

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

            for (int j = 0; j < weight; j++)
            {
                busyoListByWeight.Add(busyoId);
            }
        }

        //Get 3 by Randam without dupplication
        for (int k = 0; k < 3; k++)
        {
            int rdmId = UnityEngine.Random.Range(0, busyoListByWeight.Count);
            hitBusyo[k] = busyoListByWeight[rdmId];
        }

        return(hitBusyo);
    }
Beispiel #2
0
    public string getHeisyu(int busyoId)
    {
        Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        string           heisyu   = busyoMst.param [busyoId - 1].heisyu;

        return(heisyu);
    }
Beispiel #3
0
    public string getBusyoName(int busyoInt)
    {
        Entity_busyo_mst busyoMst  = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        string           busyoName = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            busyoName = busyoMst.param [busyoInt - 1].nameEng;
        }
        else
        {
            busyoName = busyoMst.param[busyoInt - 1].name;
        }
        return(busyoName);
    }
Beispiel #4
0
    public List <string> getSakuInfoLvMax(int busyoId)
    {
        List <string> sakuList = new List <string>();

        Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        int sakuId = busyoMst.param[busyoId - 1].saku_id;
        int sakuLv = 20;

        //Get Saku Status
        Entity_saku_mst sakuMst    = Resources.Load("Data/saku_mst") as Entity_saku_mst;
        object          sakulst    = sakuMst.param[sakuId - 1];
        Type            t          = sakulst.GetType();
        String          param      = "lv" + sakuLv;
        FieldInfo       f          = t.GetField(param);
        int             sakuStatus = (int)f.GetValue(sakulst);
        string          effection  = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            effection = sakuMst.param[sakuId - 1].effectionEng;
            effection = effection.Replace("ABC", sakuStatus.ToString());
        }
        else
        {
            effection = sakuMst.param[sakuId - 1].effection;
            effection = effection.Replace("A", sakuStatus.ToString());
        }

        sakuList.Add(sakuId.ToString());
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            sakuList.Add(sakuMst.param[sakuId - 1].nameEng); //Type
        }
        else
        {
            sakuList.Add(sakuMst.param[sakuId - 1].name); //Type
        }
        sakuList.Add(effection);
        sakuList.Add(sakuLv.ToString());
        sakuList.Add(sakuStatus.ToString());

        return(sakuList);
    }
Beispiel #5
0
    public ArrayList getOriginalSenpou(int busyoInt, bool engunFlg)
    {
        ArrayList senpouArray = new ArrayList();

        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;

        //Get Senpou Id
        int senpouId = busyoMst.param[busyoInt - 1].senpou_id;

        //Get Senpou Lv
        String senpouLvTmp = "senpou" + busyoInt;
        int    senpouLv    = PlayerPrefs.GetInt(senpouLvTmp, 1);

        //Get Senpou Status
        object    senpoulst    = senpouMst.param[senpouId - 1];
        Type      t            = senpoulst.GetType();
        String    param        = "lv" + senpouLv;
        FieldInfo f            = t.GetField(param);
        int       senpouStatus = (int)f.GetValue(senpoulst);

        //Contain in Array
        senpouArray.Add(senpouId);
        senpouArray.Add(senpouMst.param[senpouId - 1].typ);
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouArray.Add(senpouMst.param[senpouId - 1].nameEng);
            senpouArray.Add(senpouMst.param[senpouId - 1].effectionEng);
        }
        else
        {
            senpouArray.Add(senpouMst.param[senpouId - 1].name);
            senpouArray.Add(senpouMst.param[senpouId - 1].effection);
        }
        senpouArray.Add(senpouMst.param[senpouId - 1].each);
        senpouArray.Add(senpouMst.param[senpouId - 1].ratio);
        senpouArray.Add(senpouMst.param[senpouId - 1].term);
        senpouArray.Add(senpouStatus);
        senpouArray.Add(senpouLv);

        return(senpouArray);
    }
Beispiel #6
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.Contains (",")) {
			zukanBusyoHstList = new List<string> (zukanBusyoHst.Split (delimiterChars));
		} else {
			zukanBusyoHstList.Add(zukanBusyoHst);
		}

		//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){
				AllQty = AllQty + 1;

				int busyoId = busyoMst.param[i].id;
				string busyoName = busyoMst.param[i].name;
				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);

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

				//Busyo Icon
				string busyoPath = "Prefabs/Player/Unit/" + busyoId.ToString();
				GameObject busyo = Instantiate (Resources.Load (busyoPath)) as GameObject;		
				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);
				GameObject name = nameRank.transform.FindChild("Name").gameObject;
				GameObject rank = nameRank.transform.FindChild("Rank").gameObject;


				name.GetComponent<Text>().text = busyoName;
				rank.GetComponent<Text>().text = busyoRank;


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

					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
					Color textColor = new Color (255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f); //White

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

			}
		}

		//Qty
		GameObject.Find ("NowQty").GetComponent<Text> ().text = NowQty.ToString();
		GameObject.Find ("AllQty").GetComponent<Text> ().text = AllQty.ToString();

	}
Beispiel #7
0
    public List <string> getGokuiInfo(int busyoId, int gokuiId)
    {
        List <string> sakuList = new List <string>();

        Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        string           temp     = "saku" + busyoId.ToString();
        int sakuLv = PlayerPrefs.GetInt(temp, 0);

        if (sakuLv == 0)
        {
            sakuLv = 1;
            PlayerPrefs.SetInt(temp, 1);
            PlayerPrefs.Flush();
        }

        //Get Saku Status
        Entity_saku_mst sakuMst    = Resources.Load("Data/saku_mst") as Entity_saku_mst;
        object          sakulst    = sakuMst.param[gokuiId - 1];
        Type            t          = sakulst.GetType();
        String          param      = "lv" + sakuLv;
        FieldInfo       f          = t.GetField(param);
        int             sakuStatus = (int)f.GetValue(sakulst);
        string          effection  = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            effection = sakuMst.param [gokuiId - 1].effectionEng;
        }
        else
        {
            effection = sakuMst.param[gokuiId - 1].effection;
        }

        if (Application.loadedLevelName != "touyou" && Application.loadedLevelName != "tutorialTouyou")
        {
            //Kahou Adjustment
            string   kahouTemp      = "kahou" + busyoId;
            string   busyoKahou     = PlayerPrefs.GetString(kahouTemp);
            char[]   delimiterChars = { ',' };
            string[] busyoKahouList = busyoKahou.Split(delimiterChars);

            for (int i = 0; i < busyoKahouList.Length; i++)
            {
                if (i == 7)
                {
                    int kahouId = int.Parse(busyoKahouList [i]);
                    if (kahouId != 0)
                    {
                        Entity_kahou_chishikisyo_mst Mst = Resources.Load("Data/kahou_chishikisyo_mst") as Entity_kahou_chishikisyo_mst;

                        //Saku
                        float calcSenpou = ((float)sakuStatus * (float)Mst.param [kahouId - 1].kahouEffect) / 100;
                        sakuStatus = Mathf.CeilToInt((float)sakuStatus + calcSenpou);
                    }
                }
            }
        }
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            effection = effection.Replace("ABC", sakuStatus.ToString());
        }
        else
        {
            effection = effection.Replace("A", sakuStatus.ToString());
        }
        //sakuList.Add(
        sakuList.Add(gokuiId.ToString());
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            sakuList.Add(sakuMst.param [gokuiId - 1].nameEng);  //Type
        }
        else
        {
            sakuList.Add(sakuMst.param[gokuiId - 1].name); //Type
        }
        sakuList.Add(effection);
        sakuList.Add(sakuLv.ToString());
        sakuList.Add(sakuStatus.ToString());

        return(sakuList);
    }
Beispiel #8
0
    public List <string> getSakuInfoForNextLv(int busyoId)
    {
        List <string> sakuList = new List <string>();

        Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        int    sakuId             = busyoMst.param [busyoId - 1].saku_id;
        string temp   = "saku" + busyoId.ToString();
        int    sakuLv = PlayerPrefs.GetInt(temp, 0);

        if (sakuLv == 0)
        {
            sakuLv = 1;
            PlayerPrefs.SetInt(temp, 1);
            PlayerPrefs.Flush();
        }

        //Get Saku Status
        Entity_saku_mst sakuMst    = Resources.Load("Data/saku_mst") as Entity_saku_mst;
        object          sakulst    = sakuMst.param[sakuId - 1];
        Type            t          = sakulst.GetType();
        String          param      = "lv" + sakuLv;
        FieldInfo       f          = t.GetField(param);
        int             sakuStatus = (int)f.GetValue(sakulst);
        string          effection  = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            effection = sakuMst.param [sakuId - 1].effectionEng;
        }
        else
        {
            effection = sakuMst.param[sakuId - 1].effection;
        }
        int       nextSakuLv     = sakuLv + 1;
        String    param2         = "lv" + nextSakuLv;
        FieldInfo f2             = t.GetField(param2);
        int       nextSakuStatus = (int)f2.GetValue(sakulst);

        int    diffStatus       = nextSakuStatus - sakuStatus;
        string diffStatusString = sakuStatus.ToString() + "<Color=#35D74BFF>(+" + (diffStatus).ToString() + ")</Color>";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            effection = effection.Replace("ABC", diffStatusString);
        }
        else
        {
            effection = effection.Replace("A", diffStatusString);
        }

        //sakuList.Add(
        sakuList.Add(sakuId.ToString());
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            sakuList.Add(sakuMst.param [sakuId - 1].nameEng);  //Type
        }
        else
        {
            sakuList.Add(sakuMst.param[sakuId - 1].name); //Type
        }
        sakuList.Add(effection);
        sakuList.Add(sakuLv.ToString());
        sakuList.Add(sakuStatus.ToString());

        return(sakuList);
    }
Beispiel #9
0
    public List <string> getSakuInfoForLabel(int busyoId)
    {
        List <string> sakuList = new List <string>();

        Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;
        int    sakuId             = busyoMst.param [busyoId - 1].saku_id;
        string temp   = "saku" + busyoId.ToString();
        int    sakuLv = PlayerPrefs.GetInt(temp, 0);

        if (sakuLv == 0)
        {
            sakuLv = 1;
            PlayerPrefs.SetInt(temp, 1);
            PlayerPrefs.Flush();
        }

        //Get Saku Status
        Entity_saku_mst sakuMst    = Resources.Load("Data/saku_mst") as Entity_saku_mst;
        object          sakulst    = sakuMst.param[sakuId - 1];
        Type            t          = sakulst.GetType();
        String          param      = "lv" + sakuLv;
        FieldInfo       f          = t.GetField(param);
        int             sakuStatus = (int)f.GetValue(sakulst);
        float           addStatus  = 0;
        string          effection  = "";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            effection = sakuMst.param [sakuId - 1].effectionEng;
        }
        else
        {
            effection = sakuMst.param[sakuId - 1].effection;
        }

        //Kahou Adjustment
        string kahouTemp  = "kahou" + busyoId;
        string busyoKahou = PlayerPrefs.GetString(kahouTemp);

        char[]   delimiterChars = { ',' };
        string[] busyoKahouList = busyoKahou.Split(delimiterChars);

        for (int i = 0; i < busyoKahouList.Length; i++)
        {
            if (i == 7)
            {
                int kahouId = int.Parse(busyoKahouList[i]);
                if (kahouId != 0)
                {
                    Entity_kahou_chishikisyo_mst Mst = Resources.Load("Data/kahou_chishikisyo_mst") as Entity_kahou_chishikisyo_mst;

                    //Saku
                    addStatus = ((float)sakuStatus * (float)Mst.param [kahouId - 1].kahouEffect) / 100;
                }
            }
        }
        string finalStatus = sakuStatus.ToString() + "<Color=#35D74BFF>(+" + (Mathf.CeilToInt(addStatus)).ToString() + ")</Color>";

        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            effection = effection.Replace("ABC", finalStatus);
        }
        else
        {
            effection = effection.Replace("A", finalStatus);
        }

        //sakuList.Add(
        sakuList.Add(sakuId.ToString());
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            sakuList.Add(sakuMst.param [sakuId - 1].nameEng);  //Type
        }
        else
        {
            sakuList.Add(sakuMst.param[sakuId - 1].name); //Type
        }
        sakuList.Add(effection);
        sakuList.Add(sakuLv.ToString());
        sakuList.Add(sakuStatus.ToString());

        return(sakuList);
    }
Beispiel #10
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") + "%)";
    }
Beispiel #11
0
    public string getBusyoList(int powerType, int activeDaimyoId, int activeBusyoQty, int activeBusyoLv, int activeButaiQty, int activeButaiLv)
    {
        string returnString = ""; //busyoA-busyoB-busyoC...,totalhei

        int totalHei = 0;
        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);
                }
            }
        }
        //minus
        if (usedBusyoList.Count > 0)
        {
            busyoList.RemoveAll(usedBusyoList.Contains);
        }

        /*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;
        }


        int min = (activeBusyoQty - 1) / 2;

        if (min < 1)
        {
            min = 1;
        }
        int max = activeBusyoQty - 1;

        activeBusyoQty = UnityEngine.Random.Range(min, max);

        for (int i = 0; i < activeBusyoQty; i++)
        {
            int busyoId = 0;
            if (busyoList.Count > i)
            {
                if (!usedBusyoList.Contains(busyoList[i]))
                {
                    busyoId = busyoList[i];
                    usedBusyoList.Add(busyoId);
                }
                else
                {
                    busyoId = 35;
                }
            }
            else
            {
                busyoId = 35;
            }
            if (i == 0)
            {
                returnString = busyoId.ToString();
            }
            else
            {
                returnString = returnString + ":" + busyoId.ToString();
            }
            totalHei = totalHei + getHei(busyoId, activeBusyoLv, activeButaiQty, activeButaiLv);
        }
        returnString = returnString + "," + totalHei.ToString();



        return(returnString);
    }
Beispiel #12
0
    public ArrayList getEnemySenpou(int busyoId, int senpouLv, string kahouList)
    {
        ArrayList senpouArray = new ArrayList();

        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;

        if (senpouLv < 1)
        {
            senpouLv = 1;
        }
        //Get Senpou Id
        int senpouId = busyoMst.param [busyoId - 1].senpou_id;
        //Get Senpou Status
        object    senpoulst    = senpouMst.param[senpouId - 1];
        Type      t            = senpoulst.GetType();
        String    param        = "lv" + senpouLv;
        FieldInfo f            = t.GetField(param);
        int       senpouStatus = (int)f.GetValue(senpoulst);

        bool pvpFlg = false;

        if (GameObject.Find("GameScene").GetComponent <GameScene>())
        {
            pvpFlg = GameObject.Find("GameScene").GetComponent <GameScene>().pvpFlg;
        }
        if (pvpFlg)
        {
            //Kahou Adjustment
            char[]   delimiterChars = { ',' };
            string[] busyoKahouList = kahouList.Split(delimiterChars);

            Entity_kahou_heihousyo_mst Mst = Resources.Load("Data/kahou_heihousyo_mst") as Entity_kahou_heihousyo_mst;
            for (int i = 0; i < busyoKahouList.Length; i++)
            {
                if (i == 6)
                {
                    int kahouId = int.Parse(busyoKahouList[i]);
                    if (kahouId != 0)
                    {
                        float calcSenpou = ((float)senpouStatus * (float)Mst.param[kahouId - 1].kahouEffect) / 100;
                        senpouStatus = Mathf.CeilToInt((float)senpouStatus + calcSenpou);
                    }
                }
            }
        }

        //Contain in Array
        senpouArray.Add(senpouId);
        senpouArray.Add(senpouMst.param[senpouId - 1].typ);
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouArray.Add(senpouMst.param[senpouId - 1].nameEng);
            senpouArray.Add(senpouMst.param[senpouId - 1].effectionEng);
        }
        else
        {
            senpouArray.Add(senpouMst.param[senpouId - 1].name);
            senpouArray.Add(senpouMst.param[senpouId - 1].effection);
        }
        senpouArray.Add(senpouMst.param[senpouId - 1].each);
        senpouArray.Add(senpouMst.param[senpouId - 1].ratio);
        senpouArray.Add(senpouMst.param[senpouId - 1].term);
        senpouArray.Add(senpouStatus);
        senpouArray.Add(senpouLv);

        return(senpouArray);
    }
Beispiel #13
0
    public ArrayList getSenpou(int busyoInt, bool engunFlg)
    {
        ArrayList senpouArray = new ArrayList();

        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;

        //Get Senpou Id
        int senpouId = busyoMst.param [busyoInt - 1].senpou_id;

        //Get Senpou Lv
        String senpouLvTmp = "senpou" + busyoInt;
        int    senpouLv    = PlayerPrefs.GetInt(senpouLvTmp, 1);

        if (senpouLv > 20)
        {
            senpouLv = 20;
            PlayerPrefs.SetInt(senpouLvTmp, senpouLv);
            PlayerPrefs.Flush();
        }

        //Get Senpou Status
        object    senpoulst    = senpouMst.param[senpouId - 1];
        Type      t            = senpoulst.GetType();
        String    param        = "lv" + senpouLv;
        FieldInfo f            = t.GetField(param);
        int       senpouStatus = (int)f.GetValue(senpoulst);

        if (Application.loadedLevelName != "touyou" && Application.loadedLevelName != "tutorialTouyou" && !engunFlg)
        {
            //Kahou Adjustment
            string   kahouTemp      = "kahou" + busyoInt;
            string   busyoKahou     = PlayerPrefs.GetString(kahouTemp);
            char[]   delimiterChars = { ',' };
            string[] busyoKahouList = busyoKahou.Split(delimiterChars);

            Entity_kahou_heihousyo_mst Mst = Resources.Load("Data/kahou_heihousyo_mst") as Entity_kahou_heihousyo_mst;
            for (int i = 0; i < busyoKahouList.Length; i++)
            {
                if (i == 6)
                {
                    int kahouId = int.Parse(busyoKahouList[i]);
                    if (kahouId != 0)
                    {
                        //Senpou
                        float calcSenpou = ((float)senpouStatus * (float)Mst.param[kahouId - 1].kahouEffect) / 100;
                        senpouStatus = Mathf.CeilToInt((float)senpouStatus + calcSenpou);
                    }
                }
            }
        }

        //Contain in Array
        senpouArray.Add(senpouId);
        senpouArray.Add(senpouMst.param[senpouId - 1].typ);
        if (Application.systemLanguage != SystemLanguage.Japanese)
        {
            senpouArray.Add(senpouMst.param[senpouId - 1].nameEng);
            senpouArray.Add(senpouMst.param[senpouId - 1].effectionEng);
        }
        else
        {
            senpouArray.Add(senpouMst.param[senpouId - 1].name);
            senpouArray.Add(senpouMst.param[senpouId - 1].effection);
        }
        senpouArray.Add(senpouMst.param[senpouId - 1].each);
        senpouArray.Add(senpouMst.param[senpouId - 1].ratio);
        senpouArray.Add(senpouMst.param[senpouId - 1].term);
        senpouArray.Add(senpouStatus);
        senpouArray.Add(senpouLv);

        return(senpouArray);
    }
Beispiel #14
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);
                }
            }
        }
    }
Beispiel #15
0
    public void dataMake(bool busyoExitFlg, int newDaimyo, int newDaimyoBusyo, string heisyu, bool sameDaimyoFlg)
    {
        /*******************************/
        /*****      Base Value     *****/
        /*******************************/
        System.DateTime now = System.DateTime.Now;
        PlayerPrefs.SetString("lasttime", now.ToString());
        //PlayerPrefs.SetInt ("hyourou",100);
        //PlayerPrefs.SetInt ("money",10000);
        PlayerPrefs.SetString("yearSeason", "1560,1");
        PlayerPrefs.DeleteKey("gameClearFlg");
        PlayerPrefs.DeleteKey("gameClearItemGetFlg");
        PlayerPrefs.DeleteKey("gameOverFlg");
        PlayerPrefs.DeleteKey("kuniClearedFlg");


        /*******************************/
        /*****   Delete History    *****/
        /*******************************/
        PlayerPrefs.DeleteKey("TrackTotalKassenNo");
        PlayerPrefs.DeleteKey("TrackWinNo");
        PlayerPrefs.DeleteKey("TrackTettaiNo");
        PlayerPrefs.DeleteKey("TrackBiggestDaimyoId");
        PlayerPrefs.DeleteKey("TrackBiggestDaimyoHei");
        PlayerPrefs.DeleteKey("TrackMyBiggestHei");
        PlayerPrefs.DeleteKey("TrackNewBusyoHireNo");
        PlayerPrefs.DeleteKey("TrackEarnMoney");
        PlayerPrefs.DeleteKey("TrackGetMoneyNo");
        PlayerPrefs.DeleteKey("TrackGetHyourouNo");
        PlayerPrefs.DeleteKey("TrackGetSozaiNo");
        PlayerPrefs.DeleteKey("TrackBuildMoneyNo");
        PlayerPrefs.DeleteKey("TrackJyosyuNinmeiNo");
        PlayerPrefs.DeleteKey("TrackTabibitoNo");
        PlayerPrefs.DeleteKey("TrackIjinNo");
        PlayerPrefs.DeleteKey("HstNanbansen");
        PlayerPrefs.DeleteKey("TrackGaikouNo");
        PlayerPrefs.DeleteKey("TrackGaikouMoneyNo");
        PlayerPrefs.DeleteKey("TrackDoumeiNo");
        PlayerPrefs.DeleteKey("TrackCyouteiNo");
        PlayerPrefs.DeleteKey("TrackSyouninNo");
        PlayerPrefs.DeleteKey("TrackToubatsuNo");
        PlayerPrefs.DeleteKey("TrackBouryakuNo");
        PlayerPrefs.DeleteKey("TrackBouryakuSuccessNo");
        PlayerPrefs.DeleteKey("TrackCyouhouNo");
        PlayerPrefs.DeleteKey("TrackRyugenNo");
        PlayerPrefs.DeleteKey("TrackGihouHei");
        PlayerPrefs.DeleteKey("TrackCyouryakuNo");
        PlayerPrefs.DeleteKey("TrackLinkCutNo");
        PlayerPrefs.DeleteKey("TrackSyuppeiNo");


        /*******************************/
        /*****   Delete Temp Value *****/
        /*******************************/
        PlayerPrefs.DeleteKey("playerEngunList");
        PlayerPrefs.DeleteKey("enemyEngunList");
        PlayerPrefs.DeleteKey("playerKyoutouList");
        PlayerPrefs.DeleteKey("tempKyoutouList");
        PlayerPrefs.DeleteKey("keyHistory");
        PlayerPrefs.DeleteKey("metsubou");

        HPCounter deleteGunzeiScript = new HPCounter();

        for (int i = 1; i < 66; i++)
        {
            string kuniTemp = "kuni" + i.ToString();
            PlayerPrefs.DeleteKey(kuniTemp);

            string jyosyuTemp = "jyosyu" + i.ToString();
            PlayerPrefs.DeleteKey(jyosyuTemp);

            string naiseiLoginDateTemp = "naiseiLoginDate" + i.ToString();
            PlayerPrefs.DeleteKey(naiseiLoginDateTemp);

            string naiseiTabibitoCounterTemp = "naiseiTabibitoCounter" + i.ToString();
            PlayerPrefs.DeleteKey(naiseiTabibitoCounterTemp);

            string cyouhouTemp = "cyouhou" + i.ToString();
            PlayerPrefs.DeleteKey(cyouhouTemp);

            string linkuctTmp = "linkcut" + i.ToString();
            PlayerPrefs.DeleteKey(linkuctTmp);

            //Delete Enemy Gunzei
            deleteGunzeiScript.deleteEnemyGunzeiData(i);
        }

        PlayerPrefs.DeleteKey("cyouhou");
        PlayerPrefs.DeleteKey("lastSeasonChangeTime");
        PlayerPrefs.DeleteKey("doneCyosyuFlg");
        PlayerPrefs.DeleteKey("twiceHeiFlg");
        PlayerPrefs.DeleteKey("rdmEventTimer");
        PlayerPrefs.DeleteKey("fromNaiseiFlg");
        PlayerPrefs.DeleteKey("fromKassenFlg");
        PlayerPrefs.DeleteKey("kassenWinLoseFlee");
        PlayerPrefs.DeleteKey("kessenFlg");
        PlayerPrefs.DeleteKey("kessenHyourou");
        PlayerPrefs.DeleteKey("winChecker");
        PlayerPrefs.DeleteKey("isAttackedFlg");
        PlayerPrefs.DeleteKey("isKessenFlg");


        /*******************************/
        /*****      Cyoutei & Bakuhu Value    *****/
        /*******************************/
        PlayerPrefs.DeleteKey("cyoutekiDaimyo");
        PlayerPrefs.DeleteKey("cyouteiPoint");
        PlayerPrefs.SetInt("syogunDaimyoId", 14);
        PlayerPrefs.DeleteKey("bakuhuTobatsuDaimyoId");
        PlayerPrefs.DeleteKey("soubujireiFlg");


        /*******************************/
        /*****      Busyo Value    *****/
        /*******************************/

        //Jyosyu Delete
        Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;

        for (int i = 0; i < busyoMst.param.Count; i++)
        {
            int    busyoId     = i + 1;
            string daimyoTemp  = "jyosyuHei" + busyoId;
            string daimyoTemp2 = "jyosyuBusyo" + busyoId;
            PlayerPrefs.DeleteKey(daimyoTemp);
            PlayerPrefs.DeleteKey(daimyoTemp2);
        }
        PlayerPrefs.Flush();

        char[] delimiterChars = { ',' };
        if (!sameDaimyoFlg)
        {
            //Old Daimyo
            //Delete Previous Daimyo Busyo in the case of it has never been gotten by Gacya
            int preDaimyoBusyoId = PlayerPrefs.GetInt("myDaimyoBusyo");

            string        gacyaDaimyoHst     = PlayerPrefs.GetString("gacyaDaimyoHst");
            List <string> gacyaDaimyoHstList = new List <string> ();

            if (gacyaDaimyoHst != null && gacyaDaimyoHst != "")
            {
                if (gacyaDaimyoHst.Contains(","))
                {
                    gacyaDaimyoHstList = new List <string> (gacyaDaimyoHst.Split(delimiterChars));
                }
                else
                {
                    gacyaDaimyoHstList.Add(gacyaDaimyoHst);
                }
            }
            if (!gacyaDaimyoHstList.Contains(preDaimyoBusyoId.ToString()))
            {
                //delete daimyo

                //delete my busyo
                string        myBusyo     = PlayerPrefs.GetString("myBusyo");
                List <string> myBusyoList = new List <string> ();
                if (myBusyo.Contains(","))
                {
                    myBusyoList = new List <string> (myBusyo.Split(delimiterChars));
                }
                else
                {
                    myBusyoList.Add(myBusyo);
                }


                myBusyoList.Remove(preDaimyoBusyoId.ToString());
                string myNewBusyo = "";

                for (int i = 0; i < myBusyoList.Count; i++)
                {
                    if (i == 0)
                    {
                        myNewBusyo = myBusyoList [i];
                    }
                    else
                    {
                        myNewBusyo = myNewBusyo + "," + myBusyoList [i];
                    }
                }

                PlayerPrefs.SetString("myBusyo", myNewBusyo);
                int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");
                myBusyoQty = myBusyoQty - 1;
                PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);
                PlayerPrefs.Flush();

                //delete jinkei
                int  jinkeiMaxId     = 4;
                int  slotMaxId       = 25;
                bool soudaisyoSetFlg = false;
                for (int i = 1; i <= jinkeiMaxId; i++)
                {
                    for (int j = 1; j <= slotMaxId; j++)
                    {
                        string tmp = i.ToString() + "map" + j.ToString();
                        if (PlayerPrefs.HasKey(tmp))
                        {
                            int busyoId = PlayerPrefs.GetInt(tmp);
                            if (busyoId == preDaimyoBusyoId)
                            {
                                PlayerPrefs.DeleteKey(tmp);
                            }
                            else
                            {
                                if (!soudaisyoSetFlg)
                                {
                                    string sJinkeiId = "soudaisyo" + i.ToString();
                                    PlayerPrefs.SetInt(sJinkeiId, busyoId);
                                }
                            }
                        }
                    }
                }

                //kahou check
                string   tempBusyo      = "kahou" + preDaimyoBusyoId;
                string   busyoKahou     = PlayerPrefs.GetString(tempBusyo);
                string[] busyoKahouList = busyoKahou.Split(delimiterChars);
                for (int k = 0; k < busyoKahouList.Length; k++)
                {
                    int kahouId = int.Parse(busyoKahouList[k]);
                    if (kahouId != 0)
                    {
                        //back kahou data
                        string tmp = "";
                        if (k == 0)
                        {
                            tmp = "Bugu";
                        }
                        else if (k == 1)
                        {
                            tmp = "Kabuto";
                        }
                        else if (k == 2)
                        {
                            tmp = "Gusoku";
                        }
                        else if (k == 3)
                        {
                            tmp = "Meiba";
                        }
                        else if (k == 4)
                        {
                            tmp = "Cyadougu";
                        }
                        else if (k == 5)
                        {
                            tmp = "Cyadougu";
                        }
                        else if (k == 6)
                        {
                            tmp = "Heihousyo";
                        }
                        else if (k == 7)
                        {
                            tmp = "Chishikisyo";
                        }

                        string temp           = "available" + tmp;
                        string availableKahou = PlayerPrefs.GetString(temp);
                        if (availableKahou == null || availableKahou == "")
                        {
                            availableKahou = kahouId.ToString();
                        }
                        else
                        {
                            availableKahou = availableKahou + "," + kahouId.ToString();
                        }
                        PlayerPrefs.SetString(temp, availableKahou);
                        PlayerPrefs.SetString(tempBusyo, "0,0,0,0,0,0,0,0");
                    }
                }

                PlayerPrefs.Flush();
            }

            //New Daimyo
            if (!busyoExitFlg)
            {
                //Player dosen't have this daimyo busyo

                //busyo
                int myBusyoQty = PlayerPrefs.GetInt("myBusyoQty");
                myBusyoQty = myBusyoQty + 1;
                PlayerPrefs.SetInt("myBusyoQty", myBusyoQty);

                string myBusyo = PlayerPrefs.GetString("myBusyo");
                if (myBusyo != null && myBusyo != "")
                {
                    myBusyo = myBusyo + "," + newDaimyoBusyo.ToString();
                }
                else
                {
                    myBusyo = newDaimyoBusyo.ToString();
                }

                PlayerPrefs.SetString("myBusyo", myBusyo);

                if (!PlayerPrefs.HasKey(newDaimyoBusyo.ToString()))
                {
                    PlayerPrefs.SetInt(newDaimyoBusyo.ToString(), 1);
                    string tempHei    = "hei" + newDaimyoBusyo.ToString();
                    string tempSenpou = "senpou" + newDaimyoBusyo.ToString();
                    string tempSaku   = "saku" + newDaimyoBusyo.ToString();
                    string tempKahou  = "kahou" + newDaimyoBusyo.ToString();
                    string tempExp    = "exp" + newDaimyoBusyo.ToString();

                    string valueHei = heisyu + ":1:1:1";
                    PlayerPrefs.SetString(tempHei, valueHei);
                    PlayerPrefs.SetInt(tempSenpou, 1);
                    PlayerPrefs.SetInt(tempSaku, 1);
                    PlayerPrefs.SetString(tempKahou, "0,0,0,0,0,0,0,0");
                    PlayerPrefs.SetInt(tempExp, 0);
                }

                //jinkei
                //if there is no busyo in active jinkei
                int  jinkei = PlayerPrefs.GetInt("jinkei");
                bool jinkeiBusyoExistFlg = false;
                for (int i = 1; i <= 25; i++)
                {
                    string tmp = jinkei.ToString() + "map" + i.ToString();
                    if (PlayerPrefs.HasKey(tmp))
                    {
                        jinkeiBusyoExistFlg = true;
                    }
                }
                if (!jinkeiBusyoExistFlg)
                {
                    string tmpMap = "";
                    if (jinkei == 1)
                    {
                        tmpMap = jinkei.ToString() + "map11";
                    }
                    else if (jinkei == 2)
                    {
                        tmpMap = jinkei.ToString() + "map11";
                    }
                    else if (jinkei == 3)
                    {
                        tmpMap = jinkei.ToString() + "map14";
                    }
                    else if (jinkei == 4)
                    {
                        tmpMap = jinkei.ToString() + "map12";
                    }
                    PlayerPrefs.SetInt(tmpMap, newDaimyoBusyo);
                }
            }
        }

        //My Daimyo Busyo
        PlayerPrefs.SetInt("myDaimyo", newDaimyo);
        PlayerPrefs.SetInt("myDaimyoBusyo", newDaimyoBusyo);
        PlayerPrefs.DeleteKey("usedBusyo");


        /*******************************/
        /*****        Kuni Value     *****/
        /*******************************/
        string newSeiryoku = "1,2,3,4,5,6,7,8,3,4,9,10,12,11,13,14,15,16,3,17,18,17,19,8,19,19,20,21,22,23,24,25,26,27,28,29,30,31,31,32,33,34,35,35,36,37,38,38,38,38,31,31,31,39,40,41,41,41,41,42,43,44,45,45,46";

        PlayerPrefs.SetString("seiryoku", newSeiryoku);
        List <string> seiryokuList = new List <string> ();

        seiryokuList = new List <string> (newSeiryoku.Split(delimiterChars));
        string newClearedKuni = "";

        for (int i = 0; i < seiryokuList.Count; i++)
        {
            string tempDaimyoId = seiryokuList[i];
            if (tempDaimyoId == newDaimyo.ToString())
            {
                int kuniId = i + 1;
                if (newClearedKuni == null || newClearedKuni == "")
                {
                    newClearedKuni = kuniId.ToString();
                }
                else
                {
                    newClearedKuni = newClearedKuni + "," + kuniId.ToString();
                }
            }
        }
        PlayerPrefs.SetString("clearedKuni", newClearedKuni);

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

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


        //New Open Kuni
        KuniInfo kuni = new KuniInfo();

        PlayerPrefs.DeleteKey("openKuni");
        PlayerPrefs.Flush();
        foreach (string kuniId in clearedKuniList)
        {
            kuni.registerOpenKuni(int.Parse(kuniId));

            string temp = "kuni" + kuniId;
            PlayerPrefs.SetString(temp, "1,2,3,4,5,6,7,8,9,10");

            string tempNaisei = "naisei" + kuniId;
            if (!PlayerPrefs.HasKey(tempNaisei))
            {
                PlayerPrefs.SetString(tempNaisei, "1,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0,0:0");
            }
            PlayerPrefs.Flush();
        }

        //Add Cleared Kuni to OpenKuni
        string tempOpenKuni = PlayerPrefs.GetString("openKuni");

        tempOpenKuni = tempOpenKuni + "," + newClearedKuni;
        PlayerPrefs.SetString("openKuni", tempOpenKuni);
        PlayerPrefs.Flush();


        /*******************************/
        /*****     Cyouryaku Value    *****/
        /*******************************/
        string cyouryaku = PlayerPrefs.GetString("cyouryaku");

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

        if (cyouryaku != null && cyouryaku != "")
        {
            if (cyouryaku.Contains(","))
            {
                cyouryakuList = new List <string> (cyouryaku.Split(delimiterChars));
            }
            else
            {
                cyouryakuList.Add(cyouryaku);
            }
        }
        for (int i = 0; i < cyouryakuList.Count; i++)
        {
            PlayerPrefs.DeleteKey(cyouryakuList[i]);
        }
        PlayerPrefs.DeleteKey("cyouryaku");


        /*******************************/
        /*****     Gaikou Value    *****/
        /*******************************/

        //My Gaikou
        Gaikou gaikou = new Gaikou();

        for (int l = 1; l < 47; l++)
        {
            int    value = gaikou.getGaikouValue(newDaimyo, l);
            string temp  = "gaikou" + l.ToString();
            PlayerPrefs.SetInt(temp, value);

            string metsubouTemp = "metsubou" + l.ToString();
            PlayerPrefs.DeleteKey(metsubouTemp);
        }

        //Other Daimyo Gaikou
        for (int x = 2; x < 47; x++)
        {
            for (int y = 2; y < 47; y++)
            {
                if (x != y)
                {
                    string temp  = x.ToString() + "gaikou" + y.ToString();
                    string temp2 = x.ToString() + "key" + y.ToString();
                    PlayerPrefs.DeleteKey(temp);
                    PlayerPrefs.DeleteKey(temp2);
                }
            }
        }
        /*******************************/
        /*****       Shisya        *****/
        /*******************************/
        PlayerPrefs.DeleteKey("shisyaFlg");
        PlayerPrefs.DeleteKey("shisya1");
        PlayerPrefs.DeleteKey("shisya2");
        PlayerPrefs.DeleteKey("shisya3");
        PlayerPrefs.DeleteKey("shisya4");
        PlayerPrefs.DeleteKey("shisya5");
        PlayerPrefs.DeleteKey("shisya6");
        PlayerPrefs.DeleteKey("shisya7");
        PlayerPrefs.DeleteKey("shisya8");
        PlayerPrefs.DeleteKey("shisya9");
        PlayerPrefs.DeleteKey("shisya10");
        PlayerPrefs.DeleteKey("shisya11");
        PlayerPrefs.DeleteKey("shisya12");
        PlayerPrefs.DeleteKey("shisya13");
        PlayerPrefs.DeleteKey("shisya14");
        PlayerPrefs.DeleteKey("shisya15");
        PlayerPrefs.DeleteKey("shisya16");
        PlayerPrefs.DeleteKey("shisya17");
        PlayerPrefs.DeleteKey("shisya18");
        PlayerPrefs.DeleteKey("shisya19");
        PlayerPrefs.DeleteKey("shisya20");
        PlayerPrefs.DeleteKey("shisya21");



        /*******************************/
        /*****       Doumei        *****/
        /*******************************/
        //Delete doumei history
        Entity_daimyo_mst daimyoMst = Resources.Load("Data/daimyo_mst") as Entity_daimyo_mst;

        for (int i = 0; i < daimyoMst.param.Count; i++)
        {
            int    daimyoId = daimyoMst.param[i].daimyoId;
            string temp     = "doumei" + daimyoId;
            PlayerPrefs.DeleteKey(temp);
        }
        PlayerPrefs.Flush();


        PlayerPrefs.DeleteKey("doumei");
        string            newMyDoumei = "";
        Entity_doumei_mst doumeiMst   = Resources.Load("Data/doumei_mst") as Entity_doumei_mst;

        for (int i = 0; i < doumeiMst.param.Count; i++)
        {
            int srcDaimyoId = doumeiMst.param[i].doumeiSrc;
            int dstDaimyoId = doumeiMst.param[i].doumeiDst;

            if (srcDaimyoId == newDaimyo)
            {
                if (newMyDoumei != null && newMyDoumei != "")
                {
                    newMyDoumei = newMyDoumei + "," + dstDaimyoId;
                }
                else
                {
                    newMyDoumei = dstDaimyoId.ToString();
                }
            }
            else
            {
                string temp     = "doumei" + srcDaimyoId;
                string previous = PlayerPrefs.GetString(temp);

                if (previous != null && previous != "")
                {
                    previous = previous + "," + dstDaimyoId;
                    PlayerPrefs.SetString(temp, previous);
                }
                else
                {
                    PlayerPrefs.SetString(temp, dstDaimyoId.ToString());
                }
            }
        }
        PlayerPrefs.SetString("doumei", newMyDoumei);
        PlayerPrefs.Flush();


        Application.LoadLevel("mainStage");
    }
Beispiel #16
0
    public int getRandomBusyo(int activeDaimyoId, int daimyoBusyoId)
    {
        /*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;
        }


        int returnValue = 0;

        if (busyoList.Count == 0)
        {
            returnValue = 35;
        }
        else
        {
            returnValue = busyoList[0];
        }


        return(returnValue);
    }
Beispiel #17
0
    public int[] doGacya()
    {
        KumoLeftObj.GetComponent <KumoMove> ().runFlg  = true;
        KumoRightObj.GetComponent <KumoMove> ().runFlg = true;

        //Atari Busyo
        int[] hitBusyo = new int[3];

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

        Entity_busyo_mst busyoMst = Resources.Load("Data/busyo_mst") as Entity_busyo_mst;

        if (name == "DailyGacyaButton")
        {
            //Input BusyoId by Weight of each busyo
            for (int i = 0; i < busyoMst.param.Count; i++)
            {
                int weight  = busyoMst.param [i].GacyaFree;
                int busyoId = busyoMst.param[i].id;

                for (int j = 0; j < weight; j++)
                {
                    busyoListByWeight.Add(busyoId);
                }
            }

            //Get 3 by Randam without dupplication
            for (int k = 0; k < 3; k++)
            {
                int rdmId = UnityEngine.Random.Range(0, busyoListByWeight.Count);
                hitBusyo[k] = busyoListByWeight[rdmId];
            }
        }
        else if (name == "BusyoDamaGacyaButton")
        {
            //Input BusyoId by Weight of each busyo
            //SRank = 0;
            //ARank = 0;
            //BRank = 0;

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

                for (int j = 0; j < weight; j++)
                {
                    busyoListByWeight.Add(busyoId);

                    /*
                     * //test
                     * string rank = busyoMst.param[i].rank;
                     * if (rank=="S") {
                     *  SRank = SRank + 1;
                     * }else if (rank == "A") {
                     *  ARank = ARank + 1;
                     * }else if (rank == "B") {
                     *  BRank = BRank + 1;
                     * }*/
                }
            }

            //Get 3 by Randam without dupplication
            for (int k = 0; k < 3; k++)
            {
                int rdmId = UnityEngine.Random.Range(0, busyoListByWeight.Count);
                hitBusyo[k] = busyoListByWeight[rdmId];
            }
        }

        //keep gacya history

        string hitBusyoString = hitBusyo [0] + "," + hitBusyo [1] + "," + hitBusyo [2];

        PlayerPrefs.SetString("gacyaHst", hitBusyoString);
        PlayerPrefs.Flush();

        return(hitBusyo);
    }