示例#1
0
    IEnumerator SendingByURL()
    {
        WWWForm form = new WWWForm();

        form.AddField("user_sent_id", UserCommonData.pGlobal.user.user_id);

        form.AddField("user_receive_id", data.userId);
        form.AddField("gift_type_id", Random.Range(0, 4));

        WWW loader = new WWW(GiftLoader.pGlobal.SentGiftURL, form);

        yield return(loader);

        Debug.Log(loader.text);
        //check msg
        JSONObject json = new JSONObject(loader.text);
        string     msg  = json["msg"].str;

        if (msg == "OK")
        {
            Debug.Log("Set GiftCD");
            giftCD         = new GiftSend();
            giftCD.user_id = data.userId;
            giftCD.tick    = System.DateTime.UtcNow.Ticks.ToString();
            GiftSentGlobal.AddGift(giftCD);
            //start countdown here
            StartCountDown();
//			System.TimeSpan test = System.TimeSpan.FromTicks(long.Parse(gift.tick)-System.DateTime.UtcNow.Ticks);
        }
        IsSending = false;
//		yield return StartCoroutine(postAccept());
//		LoadingScript.HideLoading();
    }
示例#2
0
 public static GiftSentGlobal Instance()
 {
     if (pGlobal == null)
     {
         pGlobal = new GiftSentGlobal();
     }
     return(pGlobal);
 }
示例#3
0
 public void loadGiftCB(string msg)
 {
     giftMsg    = msg;
     IsCallGift = true;
             #if !UNITY_WEBGL && !DISABLE_WEBVIEW
     GiftSentGlobal.Initialize();
             #else
     GiftSentGlobal.Initialize(giftMsg);
             #endif
     GiftSentGlobal.UpdateGift();
 }
示例#4
0
 public static void Initialize(string message)
     #endif
 {
     pGlobal          = GiftSentGlobal.Instance();
     pGlobal.filePath = Application.persistentDataPath + "/" + "GiftList.xml";
     pGlobal.file     = GiftSendSaveFile.Load(pGlobal.filePath);
     if (pGlobal.file.SendItem != null)
     {
         pGlobal.sentList = new List <GiftSend>(pGlobal.file.SendItem);
     }
     else
     {
         pGlobal.sentList = new List <GiftSend>();
     }
 }
示例#5
0
    void Start()
    {
        pGlobal = this;

                #if !UNITY_WEBGL && !DISABLE_WEBVIEW
        GiftSentGlobal.Initialize();
        GiftSentGlobal.UpdateGift();
                #elif UNITY_EDITOR
                #else
        Application.ExternalCall("checkGiftOryor", UserCommonData.imei);
        btBack.SetActive(false);
                #endif

        Award.gameObject.SetActive(true);
        Ranking.gameObject.SetActive(true);
        Gift.gameObject.SetActive(true);
        money.SetStartMoney(int.Parse(UserCommonData.pGlobal.user.user_money));
        exp.SetCurrentProgress(UserCommonData.pGlobal.GetEXPProgress(), int.Parse(UserCommonData.pGlobal.user.user_level));
        state = GameLandState.GS_MAPMODE;
    }
示例#6
0
    public void SetRankItem(int idx, float Height, RankingData _data, int gameId, int rank)
    {
        data      = _data;
        Name.text = _data.user_name;
        if (rank == 1)
        {
            RankText.SetActive(false);
            RankIcon.gameObject.SetActive(true);
            RankIcon.sprite = Rank1;
        }
        else if (rank == 2)
        {
            RankText.SetActive(false);
            RankIcon.gameObject.SetActive(true);
            RankIcon.sprite = Rank2;
        }
        else if (rank == 3)
        {
            RankText.SetActive(false);
            RankIcon.gameObject.SetActive(true);
            RankIcon.sprite = Rank3;
        }
        else
        {
            RankText.SetActive(true);
            RankIcon.gameObject.SetActive(false);
        }
        RankNumber.text = rank.ToString();
        switch (gameId)
        {
        case 0:
            //all
            Score.text = _data.scoreAll.ToString("#,##0");
            break;

        case 1:
            Score.text = _data.score[0].ToString("#,##0");
            break;

        case 2:
            Score.text = _data.score[1].ToString("#,##0");
            break;

        case 3:
            Score.text = _data.score[2].ToString("#,##0");
            break;

        case 4:
            Score.text = _data.score[3].ToString("#,##0");
            break;

        case 5:
            Score.text = _data.score[4].ToString("#,##0");
            break;

        case 6:
            Score.text = _data.score[5].ToString("#,##0");
            break;
        }
        //check if Gift is avaliable
        giftCD = GiftSentGlobal.getGift(data.userId);
        if ((giftCD != null) && (GiftSentGlobal.CalculateCountDownTick(giftCD) > 0))
        {
            //start countdown Routine
            StartCountDown();
        }
        else
        {
            //enable sent gift
            SendGiftButton.enabled = true;
            SendGiftButton.GetComponent <SpriteRenderer>().color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
            CountDown.gameObject.SetActive(false);
        }
        transform.localPosition = new Vector3(0, idx * -Height, 0);
    }