Exemplo n.º 1
0
    public void setReward(int itemID, int count)
    {
        reward = new DataReward(itemID, count);

        if (imageSprite == null)
        {
            return;
        }

        if (reward.id < 0 || reward.count < 1)
        {
            imageSprite.enabled = false;
        }
        else
        {
            DataTile tile = WorldData.tiles[reward.id];
            if (tile != null)
            {
                imageSprite.sprite  = tile.sprite;
                imageSprite.enabled = true;
            }
            else
            {
                imageSprite.enabled = false;
            }
        }
    }
Exemplo n.º 2
0
    private void Start()
    {
        //Init Data Maker
        userId = PlayerPrefs.GetString("userId");
        //userId = "testtphnii20170323113213"; PlayerPrefs.SetString("userId", userId);
        initDataDoneFlg = PlayerPrefs.GetBool("initDataFlg");
        if (!initDataDoneFlg)
        {
            if (userId == "" || userId == null)
            {
                InitDataMaker initData = transform.FindChild("InitDataMaker").GetComponent <InitDataMaker>();
                initData.makeInitData();
            }
        }

        //User Data Update
        DataUserId DataUserId      = GetComponent <DataUserId>();
        DataJinkei DataJinkei      = GetComponent <DataJinkei>();
        bool       tutorialDoneFlg = PlayerPrefs.GetBool("tutorialDoneFlg");

        if (tutorialDoneFlg)
        {
            if (userId == "" || userId == null)
            {
                //New UserId
                string          randomA = StringUtils.GeneratePassword(10);
                System.DateTime now     = System.DateTime.Now;
                string          randomB = now.ToString("yyyyMMddHHmmss");
                string          userId  = randomA + randomB;
                PlayerPrefs.SetString("userId", userId);
                PlayerPrefs.Flush();
                if (Application.internetReachability != NetworkReachability.NotReachable)
                {
                    DataUserId.InsertUserId(userId);
                }
            }
            else
            {
                //Update UserId
                if (Application.internetReachability != NetworkReachability.NotReachable)
                {
                    DataUserId.UpdateUserId(userId);
                    DataJinkei.UpdateJinkei(userId);

                    //Reward
                    DataReward DataReward = GetComponent <DataReward>();
                    DataReward.GetRewardMaster(userId);

                    //Delete Gunzei Data : Rescue
                    DataDelete DataDelete = GetComponent <DataDelete>();
                    DataDelete.GunzeiDelete(userId);
                }
            }
        }
    }
Exemplo n.º 3
0
    void createPanel(int tag, int x, int y)
    {
        rewards[tag] = new DataReward(-1, 0);

        GameObject slot = Instantiate(Resources.Load("PanelItem")) as GameObject;

        slot.transform.SetParent(transform, false);
        slot.GetComponent <RectTransform>().anchoredPosition = new Vector2(x, -y);
        slot.GetComponent <Button>().onClick.AddListener(delegate { onPanelClick(tag); });

        slots[tag] = slot.GetComponent <InventoryPanel>();
        slots[tag].setReward(-1, 0);
    }
Exemplo n.º 4
0
    public void setReward(int itemID, int count)
    {
        reward = new DataReward(itemID, count);

        if (imageSprite == null) return;

        if (reward.id < 0 || reward.count < 1) {
            imageSprite.enabled = false;
        } else {
            DataTile tile = WorldData.tiles[reward.id];
            if (tile != null) {
                imageSprite.sprite = tile.sprite;
                imageSprite.enabled = true;
            } else {
                imageSprite.enabled = false;
            }
        }
    }
Exemplo n.º 5
0
 public void setReward(DataReward rew)
 {
     setReward(rew.id, rew.count);
 }
Exemplo n.º 6
0
 public static void SetReward(DataReward rew)
 {
     _instance.setReward(rew);
 }
Exemplo n.º 7
0
 public static bool addReward(DataReward rew)
 {
     return(addReward(rew.id, rew.count));
 }
Exemplo n.º 8
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();

        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            //接続されていないときの処理
            Message msg = new Message();
            msg.makeMessage(msg.getMessage(136));
            audioSources[4].Play();
        }
        else
        {
            audioSources[3].Play();

            //NCMB delete
            NCMBObject query = new NCMBObject("reward");
            query.ObjectId = objectId;
            query.DeleteAsync();

            //List delete
            DataReward DataRewardObj = GameObject.Find("DataStore").GetComponent <DataReward>();
            int        line          = 0;
            for (int i = 0; i < DataRewardObj.objectIdList.Count; i++)
            {
                if (objectId == DataRewardObj.objectIdList[i])
                {
                    line = i;
                }
            }
            DataRewardObj.objectIdList.RemoveAt(line);
            DataRewardObj.itemTitleList.RemoveAt(line);
            DataRewardObj.itemGrpList.RemoveAt(line);
            DataRewardObj.itemRankList.RemoveAt(line);
            DataRewardObj.itemQtyList.RemoveAt(line);

            //visual delete
            Destroy(slot);

            //item register
            if (grp == "money")
            {
                Message msgScript = new Message();
                string  msg       = "";
                int     money     = PlayerPrefs.GetInt("money");
                int     newMoney  = money + qty;
                if (newMoney < 0)
                {
                    newMoney = int.MaxValue;
                }
                PlayerPrefs.SetInt("money", newMoney);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got " + qty + " money.";
                }
                else
                {
                    msg = "金を" + qty + "受領しました。";
                }
                msgScript.makeMessage(msg);
            }
            else if (grp == "stone")
            {
                Message msgScript    = new Message();
                string  msg          = "";
                int     busyoDama    = PlayerPrefs.GetInt("busyoDama");
                int     newBusyoDama = busyoDama + qty;
                PlayerPrefs.SetInt("busyoDama", newBusyoDama);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got " + qty + " stone.";
                }
                else
                {
                    msg = "武将珠を" + qty + "個受領しました。";
                }
                msgScript.makeMessage(msg);
            }
            else if (grp == "busyo")
            {
                audioSources[7].Play();
                receiveBusyo(busyoId);
            }
            else if (grp == "kaho")
            {
                receiveKaho();
            }
            else if (grp == "syokaijyo")
            {
                receiveShokaijyo(rank, qty);
            }
            else if (grp == "shiro")
            {
                Shiro   shiro     = new Shiro();
                int     shiroId   = shiro.getRandomId();
                string  shiroName = shiro.getName(shiroId);
                Message msgScript = new Message();
                string  msg       = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got " + shiroName + ". You can enhance your castle in town development.";
                }
                else
                {
                    msg = "天下の要害、" + shiroName + "を築城できますぞ。内政で城を増強しましょう。";
                }
                msgScript.makeMessage(msg);
                shiro.registerShiro(shiroId);
            }
            else if (grp == "jinkei")
            {
                if (rank == "1")
                {
                    PlayerPrefs.SetBool("addJinkei1", true);
                }
                else if (rank == "2")
                {
                    PlayerPrefs.SetBool("addJinkei2", true);
                }
                else if (rank == "3")
                {
                    PlayerPrefs.SetBool("addJinkei3", true);
                }
                else if (rank == "4")
                {
                    PlayerPrefs.SetBool("addJinkei4", true);
                }
                Message msgScript = new Message();
                string  msg       = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got an additional formation.";
                }
                else
                {
                    msg = "追加陣形を受領しました。";
                }
                msgScript.makeMessage(msg);
            }
            else
            {
                PlayerPrefs.SetInt(grp, qty);
                Message msgScript = new Message();
                string  msg       = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got " + qty.ToString() + " " + grp + ".";
                }
                else
                {
                    msg = grp + "を" + qty + "入手しました。";
                }
                msgScript.makeMessage(msg);
            }
            PlayerPrefs.Flush();
        }
    }
Exemplo n.º 9
0
    public int iCrystal = 0;                                                // 水晶, 用來購買水晶商人的貨品

    void Awake()
    {
        pthis = this;
    }
Exemplo n.º 10
0
    void Start()
    {
        DataReward DataReward = GameObject.Find("DataStore").GetComponent <DataReward>();
        GameObject content    = GameObject.Find("Content").gameObject;

        for (int i = 0; i < DataReward.itemTitleList.Count; i++)
        {
            string objectId = DataReward.objectIdList[i];
            string title    = DataReward.itemTitleList[i];
            string grp      = DataReward.itemGrpList[i];
            string rank     = DataReward.itemRankList[i];
            int    qty      = DataReward.itemQtyList[i];

            string     slotPath = "Prefabs/PvP/RewardSlot";
            GameObject slot     = Instantiate(Resources.Load(slotPath)) as GameObject;
            slot.transform.SetParent(content.transform);
            slot.transform.localScale = new Vector2(1, 1);

            //view
            slot.transform.FindChild("title").GetComponent <Text>().text = title;

            //hide other image
            GameObject    imageContent  = slot.transform.FindChild("ScrollView").transform.FindChild("Viewport").transform.FindChild("Content").gameObject;
            RewardReceive RewardReceive = slot.transform.FindChild("button").GetComponent <RewardReceive>();

            foreach (Transform obj in imageContent.transform)
            {
                if (obj.name != grp)
                {
                    Destroy(obj.gameObject);
                    slot.transform.FindChild("circle").transform.FindChild("Text").GetComponent <Text>().text  = grp;
                    slot.transform.FindChild("circle").transform.FindChild("Text").GetComponent <Text>().color = new Color(255f / 255f, 255f / 255f, 255f / 255f, 255f / 255f);
                }
                else
                {
                    if (grp == "money")
                    {
                        obj.transform.FindChild("qty").GetComponent <Text>().text = qty.ToString();
                    }
                    else if (grp == "stone")
                    {
                        obj.transform.FindChild("qty").GetComponent <Text>().text = qty.ToString();
                    }
                    else if (grp == "busyo")
                    {
                        obj.transform.FindChild("rank").GetComponent <Text>().text = rank;
                        BusyoInfoGet BusyoInfoGet = new BusyoInfoGet();
                        int          busyoId      = BusyoInfoGet.getRandomBusyoId(rank);
                        RewardReceive.busyoId = busyoId;
                    }
                    else if (grp == "kaho")
                    {
                        obj.transform.FindChild("qty").GetComponent <Text>().text  = "x " + qty.ToString();
                        obj.transform.FindChild("rank").GetComponent <Text>().text = rank;

                        //kahouType bugu,kabuto,gusoku,meiba,cyadougu,heihousyo,chishikisyo
                        for (int j = 0; j < qty; j++)
                        {
                            List <string> kahouuTypeList = new List <string>()
                            {
                                "bugu", "kabuto", "gusoku", "meiba", "cyadougu", "heihousyo", "chishikisyo"
                            };
                            int    rdmId   = UnityEngine.Random.Range(0, kahouuTypeList.Count);
                            string kahoTyp = kahouuTypeList[rdmId];

                            Kahou Kahou  = new Kahou();
                            int   kahoId = Kahou.getRamdomKahouId(kahoTyp, rank);
                            RewardReceive.kahoTypList.Add(kahoTyp);
                            RewardReceive.kahoIdList.Add(kahoId);
                            RewardReceive.kahoNameList.Add(Kahou.getKahouName(kahoTyp, kahoId));
                        }
                    }
                    else if (grp == "syokaijyo")
                    {
                        string rankTmp = "";
                        if (Application.systemLanguage != SystemLanguage.Japanese)
                        {
                            if (rank == "S")
                            {
                                rankTmp = "High";
                            }
                            else if (rank == "A")
                            {
                                rankTmp = "Mid";
                            }
                            else if (rank == "B")
                            {
                                rankTmp = "Low";
                            }
                        }
                        else
                        {
                            if (rank == "S")
                            {
                                rankTmp = "上";
                            }
                            else if (rank == "A")
                            {
                                rankTmp = "中";
                            }
                            else if (rank == "B")
                            {
                                rankTmp = "下";
                            }
                        }
                        obj.transform.FindChild("qty").GetComponent <Text>().text  = "x " + qty.ToString();
                        obj.transform.FindChild("rank").GetComponent <Text>().text = rankTmp;
                    }
                }
            }

            //Set Value
            RewardReceive.slot     = slot;
            RewardReceive.objectId = objectId;
            RewardReceive.grp      = grp;
            RewardReceive.qty      = qty;
            RewardReceive.rank     = rank;
        }
    }
Exemplo n.º 11
0
 public DataReward(DataReward rew)
 {
     id    = rew.id;
     count = rew.count;
 }
Exemplo n.º 12
0
 public void setReward(DataReward rew)
 {
     setReward(rew.id, rew.count);
 }
Exemplo n.º 13
0
 public static void SetReward(DataReward rew)
 {
     _instance.setReward(rew);
 }
Exemplo n.º 14
0
 public DataReward(DataReward rew)
 {
     id = rew.id;
     count = rew.count;
 }
Exemplo n.º 15
0
 public void putinHand(DataReward rew)
 {
     putinHand(rew.id, rew.count);
 }
Exemplo n.º 16
0
 public void putinHand(DataReward rew)
 {
     putinHand(rew.id, rew.count);
 }