Exemple #1
0
    void Update()
    {
        //get jinkei
        if (userId != "" && !isJinkeiMapFetched)
        {
            PvPDataStore.GetEnemyJinkei(userId, pvpStageId);
            isJinkeiMapFetched = true;
        }

        //get busyo data
        if (pvpStageId == 1)
        {
            if (PvPDataStore.PvP1BusyoList != null && PvPDataStore.PvP1BusyoList.Count != 0 && !isBusyoStatusFetched)
            {
                isBusyoStatusFetched = true;
            }
        }
        else if (pvpStageId == 2 && userId != "")
        {
            if (PvPDataStore.PvP2BusyoList != null && PvPDataStore.PvP2BusyoList.Count != 0 && !isBusyoStatusFetched)
            {
                isBusyoStatusFetched = true;
            }
        }
        else if (pvpStageId == 3 && userId != "")
        {
            if (PvPDataStore.PvP3BusyoList != null && PvPDataStore.PvP3BusyoList.Count != 0 && !isBusyoStatusFetched)
            {
                isBusyoStatusFetched = true;
            }
        }

        //register temp lose tran
        if (userId != "" && isJinkeiMapFetched && isBusyoStatusFetched && clickedFlg && !PvPDataStore.PvPAtkNoFlg && !updatePvPAtkFlg)
        {
            updatePvPAtkFlg = true;
            PvPController   = GameObject.Find("GameScene").GetComponent <PvPController>();
            PvPDataStore.UpdatePvPAtkNo(PvPController.myUserId, int.Parse(PvPController.todayNCMB));
            PvPDataStore.enemyUserId   = userId;
            PvPDataStore.enemyUserName = enemyUserName;
            PvPDataStore.myUserName    = PvPController.myUserName;
            PvPDataStore.getPt         = getPt;
            PvPDataStore.todayNCMB     = int.Parse(PvPDataStore.PvPTimer.todayNCMB);
        }

        //register temp lose tran
        if (userId != "" && isJinkeiMapFetched && isBusyoStatusFetched && clickedFlg && PvPDataStore.PvPAtkNoFlg && updatePvPAtkFlg && !PvPDataStore.donePlusUpdatePtFlg && !updateLosePtFlg)
        {
            updateLosePtFlg = true;
            PvPDataStore.UpdatePvPPt(userId, true, getPt);
        }

        if (userId != "" && isJinkeiMapFetched && isBusyoStatusFetched && clickedFlg && PvPDataStore.PvPAtkNoFlg && updatePvPAtkFlg && PvPDataStore.donePlusUpdatePtFlg && updateLosePtFlg && !PvPDataStore.doneMinusUpdatePtFlg && !updateWinPtFlg)
        {
            updateWinPtFlg = true;
            PvPDataStore.UpdatePvPPt(PvPController.myUserId, false, getPt);
        }



        //scene change
        if (userId != "" && isJinkeiMapFetched && isBusyoStatusFetched && clickedFlg && PvPDataStore.PvPAtkNoFlg && updatePvPAtkFlg && PvPDataStore.donePlusUpdatePtFlg && PvPDataStore.doneMinusUpdatePtFlg && updateLosePtFlg && updateWinPtFlg && !sceneChangeFlg)
        {
            //hyourou
            int newHyourou = nowHyourou - 5;
            PlayerPrefs.SetInt("hyourou", newHyourou);
            PlayerPrefs.SetBool("pvpFlg", true);

            //money and exp calculation
            int minExp = getPvPMinExp(PvPController.per);
            int maxExp = getPvPMaxExp(PvPController.per);
            int exp    = UnityEngine.Random.Range(minExp, maxExp + 1);

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

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

            AttackNaiseiView AttackNaiseiView = new AttackNaiseiView();
            if (itemGrp == "item")
            {
                itemTyp = AttackNaiseiView.getRandomItemTyp(itemGrp);
                if (itemTyp == "tech")
                {
                    itemId = AttackNaiseiView.getItemRank(66, 33);
                }
                else if (itemTyp == "Tama")
                {
                    itemId = AttackNaiseiView.getItemRank(20, 5);
                    if (itemId == 3)
                    {
                        itemQty = 100;
                    }
                    else if (itemId == 2)
                    {
                        itemQty = 50;
                    }
                    else if (itemId == 1)
                    {
                        itemQty = 10;
                    }
                }
                else
                {
                    itemId = AttackNaiseiView.getItemRank(20, 5);
                }
            }
            else if (itemGrp == "kahou")
            {
                itemTyp = AttackNaiseiView.getRandomItemTyp(itemGrp);
                Kahou  kahou     = new Kahou();
                string kahouRank = AttackNaiseiView.getKahouRank();
                itemId = kahou.getRamdomKahouId(itemTyp, kahouRank);
            }
            PlayerPrefs.SetInt("activeStageMoney", money);
            PlayerPrefs.SetInt("activeStageExp", exp);
            PlayerPrefs.SetString("activeItemGrp", itemGrp);
            PlayerPrefs.SetString("activeItemType", itemTyp);
            PlayerPrefs.SetInt("activeItemId", itemId);
            PlayerPrefs.SetInt("activeItemQty", itemQty);

            PlayerPrefs.Flush();

            sceneChangeFlg = true;
            Application.LoadLevel("kassen");
        }
    }
Exemple #2
0
    public void getWinItem()
    {
        Message msg = new Message();

        AttackNaiseiView script     = new AttackNaiseiView();
        HPCounter        hpScript   = new HPCounter();
        Item             itemScript = new Item();
        string           itemGrp    = getRandomItemGrp();
        string           itemTyp    = "";
        int    itemId   = 0;
        int    itemQty  = 1;
        string itemName = "";
        string MsgText  = "";

        if (itemGrp == "item")
        {
            itemTyp = script.getRandomItemTyp(itemGrp);


            if (itemTyp == "tech")
            {
                itemId = script.getItemRank(30, 10);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    MsgText = "You got " + itemScript.getItemName(itemTyp + itemId.ToString()) + ".";
                }
                else
                {
                    MsgText = itemScript.getItemName(itemTyp + itemId.ToString()) + "を手に入れましたぞ。";
                }
                msg.makeMeshMessage(MsgText);
            }
            else if (itemTyp == "Tama")
            {
                itemId = script.getItemRank(10, 1);
                if (itemId == 3)
                {
                    itemQty = 100;
                }
                else if (itemId == 2)
                {
                    itemQty = 20;
                }
                else if (itemId == 1)
                {
                    itemQty = 5;
                }
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    MsgText = "You got " + itemQty.ToString() + " stone.";
                }
                else
                {
                    MsgText = "武将珠を" + itemQty.ToString() + "個手に入れましたぞ。";
                }
                msg.makeMeshMessage(MsgText);
            }
            else
            {
                itemId = script.getItemRank(10, 1);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    MsgText = "You got " + itemScript.getItemName(itemTyp + itemId.ToString()) + ".";
                }
                else
                {
                    MsgText = itemScript.getItemName(itemTyp + itemId.ToString()) + "を手に入れましたぞ。";
                }
                msg.makeMeshMessage(MsgText);
            }
        }
        else if (itemGrp == "kahou")
        {
            itemTyp = script.getRandomItemTyp(itemGrp);
            Kahou  kahou     = new Kahou();
            string kahouRank = getKahouRank();
            itemId   = kahou.getRamdomKahouId(itemTyp, kahouRank);
            itemName = kahou.getKahouName(itemTyp, itemId);
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                MsgText = "You got treasure, " + itemName + ".";
            }
            else
            {
                MsgText = "家宝、" + itemName + "を手に入れましたぞ。";
            }
            msg.makeMeshMessage(MsgText);
            hpScript.addKahou(itemTyp, itemId);
        }
        else if (itemGrp == "money")
        {
            itemQty = UnityEngine.Random.Range(100, 500);
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                MsgText = "You got money " + itemQty.ToString() + ".";
            }
            else
            {
                MsgText = "金" + itemQty.ToString() + "を手に入れましたぞ。";
            }
            msg.makeMeshMessage(MsgText);

            int currentMoney = PlayerPrefs.GetInt("money");
            int newMoney     = currentMoney + itemQty;
            if (newMoney < 0)
            {
                newMoney = int.MaxValue;
            }
            PlayerPrefs.SetInt("money", newMoney);
            GameObject.Find("MoneyValue").GetComponent <Text>().text = newMoney.ToString();
        }
        else
        {
            if (Application.systemLanguage != SystemLanguage.Japanese)
            {
                MsgText = "No items";
            }
            else
            {
                MsgText = "戦利品はありませんでした。";
            }
            msg.makeMeshMessage(MsgText);
        }

        registerItemQty(itemGrp, itemTyp, itemId, itemQty);
        PlayerPrefs.Flush();
    }