예제 #1
0
    public static DateTime Now()  // Current time by Server ...
    {
        TimeSpan secon = (DateTime.Now - Ag.DTNowTickMark);

        //Ag.LogString (" DateTime.Now " + DateTime.Now + "   TickMark " + Ag.DTNowTickMark + "  TimeNow : " + TimeNow + "  Sec : " + secon.TotalSeconds);
        return(Ag.UnixTimeStampToDateTime(Ag.TimeNow + secon.TotalSeconds));
    }
    // Update is called once per frame
    void Update()
    {
        //Debug.Log ("Userid   Checked" + userid);
        //if (KakaoGameFriends.Instance.leaderboardFriends[userid].messageBlocked && Myuserid ()) {
        if (StcPlatform.dicFriends[userid].IsBlocked && Myuserid())
        {
            btn_WaitMessageSend.gameObject.SetActive(false);
            btn_recieveoff.gameObject.SetActive(false);
            btn_recieveok.gameObject.SetActive(false);
            btn_sendgift.gameObject.SetActive(false);
            btn_donsend.gameObject.SetActive(true);
        }

        //if (KakaoGameFriends.Instance.leaderboardFriends[userid].lastMessageSentAt != 0 && !KakaoGameFriends.Instance.leaderboardFriends[userid].messageBlocked && Myuserid()) {
        if (StcPlatform.dicFriends[userid].CanSendMsg && Myuserid())
        {
            btn_recieveoff.SetActive(false);
            btn_recieveok.SetActive(false);
            Hour     = (Ag.UnixTimeStampToDateTime(KakaoGameFriends.Instance.leaderboardFriends[userid].lastMessageSentAt).AddSeconds(KakaoGameInfo.Instance.game_message_interval) - DateTime.Now).Hours;
            Minitues = (Ag.UnixTimeStampToDateTime(KakaoGameFriends.Instance.leaderboardFriends[userid].lastMessageSentAt).AddSeconds(KakaoGameInfo.Instance.game_message_interval) - DateTime.Now).Minutes;
            Second   = (Ag.UnixTimeStampToDateTime(KakaoGameFriends.Instance.leaderboardFriends[userid].lastMessageSentAt).AddSeconds(KakaoGameInfo.Instance.game_message_interval) - DateTime.Now).Seconds;
            if (Ag.UnixTimeStampToDateTime(KakaoGameFriends.Instance.leaderboardFriends [userid].lastMessageSentAt).AddSeconds(KakaoGameInfo.Instance.game_message_interval) > DateTime.Now)
            {
                Debug.Log(Minitues + " :: " + Second + " :: Time");
                btn_WaitMessageSend.SetActive(true);
                btn_sendgift.SetActive(false);
                btn_WaitMessageSendLabel.GetComponent <UILabel>().text = Hour > 0 ? ((int)Hour).ToFixedWidth(2) + ":" + ((int)Minitues).ToFixedWidth(2) : ((int)Minitues).ToFixedWidth(2) + ":" + ((int)Second).ToFixedWidth(2);
                btn_WaitMessageSendLabel.SetActive(true);
            }
            else
            {
                btn_sendgift.gameObject.SetActive(true);
                btn_WaitMessageSend.gameObject.SetActive(false);
            }
        }
        if (KakaoGameFriends.Instance.leaderboardFriends[userid].lastMessageSentAt == 0 && !KakaoGameFriends.Instance.leaderboardFriends[userid].messageBlocked && Myuserid())
        {
            btn_recieveoff.gameObject.SetActive(false);
            btn_recieveok.gameObject.SetActive(false);
            btn_sendgift.gameObject.SetActive(true);
            btn_WaitMessageSend.gameObject.SetActive(false);
        }
    }
예제 #3
0
    //  _////////////////////////////////////////////////_    _____   Send   _____   Receive   _____
    public void SendAndRciv()
    {
        //Ag.NetExcpt.WASActionTime = DateTime.Now;

        IsOK = null;
        Ag.LogString(" {{ " + TpStr + " }} :  SendAndRciv () >>> SEND ing >>    " + SendStr);
        try {
            RetryN++;

            RcvdStr = WAS.SendWASvrMessage(SendStr, Encript);
            Result  = new WasResult();
            Ag.LogString(" {{ " + TpStr + " }}    Received  () :: " + RcvdStr);
            if (RcvdStr == "CATCH")
            {
                IsOK          = false;
                Result.result = -99;
                return;
            }

            IsOK  = true;
            NdObj = JSON.Parse(RcvdStr);

            Result.result = -1;                                   // Default
            try {
                Result.serviceCode = NdObj ["serviceCode"].AsInt; // JData ["serviceCode"];
                Result.result      = NdObj ["result"].AsInt;      // (int)JData ["result"];  //  OK => 0 ...

                if (Result.result == 501)
                {
                    Ag.NetExcpt.WasLoginDuplicate = true;
                }
                else
                {
                    Ag.NetExcpt.WasLoginDuplicate = false;
                }

                Ag.LogString(" {{ " + TpStr + " }}          Result : " + Result.result + "        serviceCode : " + Result.serviceCode);
            } catch {
                Ag.LogIntenseWord(" {{ " + TpStr + " }} SendAndRciv () >>>  No result, serviceCode  !!   ");
            }
            try {
                if ((Result.result == 0 || Result.result == 4) && NdObj ["cash1"].AsBool)
                {
                    User.mCash1 = Ag.mySelf.mCash1 = NdObj ["cash1"].AsInt;
                    User.mCash2 = Ag.mySelf.mCash2 = NdObj ["cash2"].AsInt;
                    User.mGold  = Ag.mySelf.mGold = NdObj ["gold"].AsInt;
                    User.ShowCurrentCash();   // Log ..
                }
            } catch {
                Ag.LogString(" {{ " + TpStr + " }}  Result : " + Result.result + " serviceCode : " + Result.serviceCode + "   has  No Cash Info ...  OK ");
                //" No Cash Info ...  OK  ".HtLog ();
            }

            try {
                Ag.TimeNow       = long.Parse(NdObj ["serverTimeStampToUTC"]) / 1000;
                Ag.DTNowTickMark = DateTime.Now;
                Ag.LogString("   ServerTime :: " + Ag.UnixTimeStampToDateTime(Ag.TimeNow));
                //Ag.LogString ("   Parsing Time :: >>>    " + Ag.TimeNow);
            } catch {
                Ag.LogDouble(" {{ " + TpStr + " }}   ::   has  No Time Info ...  OK ");
            }

            if (postAction != null)
            {
                postAction();
            }
            //Ag.LogString (" {{ " + TpStr + " }} SendAndRciv () :: " + RcvdStr);
            Ag.LogNewLine(3);
        } catch {
            Ag.LogNewLine(5);
            Ag.LogString(" {{ " + TpStr + " }} SendAndRciv () >>>   Catch  !!!!!!!!   ");
            Ag.LogNewLine(5);
            CatchAction();
        }
    }
예제 #4
0
    bool ParseUserProp(JSONNode pData)
    {
        string header = "  ParseUserProp ::>>   ";

        try {
            Ag.LogStartWithStr(1, header + " Country , League, etcInfo, freeCoupon ");
            WAS.Country = pData ["country"].AsInt;
            try {
                WAS.TeamName = pData ["teamName"];
            } catch {
                " Team Name Error.  ".HtLog();
            }
            pData.ParseTo("league", out WAS.League, "etcInfo", out WAS.etcInfo);
            try {
                FreeCouponTime = long.Parse(pData ["freeCouponDate"]) / 1000;  // formatVersion 1 : yyyyMMddHHmmss .. parse ..
                FreeCouponDT   = Ag.UnixTimeStampToDateTime(FreeCouponTime);

                Ag.LogString("  freeCouponDate : " + pData ["freeCouponDate"]);  // Ag.UnixTimeStampToDateTime (
                Ag.LogString("  FreeCouponDT : " + FreeCouponDT + "   Remain Sec   " + FreeCouponTS.TotalSeconds + "  IsFreeCouponRemain ? " + IsFreeCouponRemain);
            } catch {
                FreeCouponTime = Ag.TimeNow;
                " Free Coupon Date Not Set  >>  set to now  ".HtLog();
            }
        } catch {
            Ag.LogIntenseWord(" [< AmUserNet.cs >]       Parse User Info  [ Country, league, freeCoupon  ] >>>>>  E R R O R  :: ");
        }

        if (WAS.League == null || WAS.League.Length < 3)
        {
            WAS.League = "PRO_5";
        }

        try {
            pData.ParseTo("cost", out WAS.Cost, "reviewEvent", out WAS.reviewEvent);  // 리뷰 확인 0: 아직 안함, 1: 함..
            pData.ParseTo("gold", out mGold, "cash1", out mCash1, "cash2", out mCash2);
            (header + " gold / cash1 / cash2  " + mGold + "  " + mCash1 + "  " + mCash2).HtLog();
        } catch {
            Ag.LogIntenseWord(" [< AmUserNet.cs >]       Parse User Info  [ cost, review, gold/cash  ] >>>>>  E R R O R  :: ");
            return(false);
        }

        if (pData ["etcInfo"].ToString().IsJsonNull())
        {
            "   etcInfo is NULL  Reset ... and Update   ".HtLog();
            etcInfoObj = new WasUserEtcInfo();
            DateTime dtNow = DateTime.Now;
            etcInfoObj.DailyChkMon = dtNow.Month;
            etcInfoObj.DailyChkDay = dtNow.Day;

            etcInfoObj.HeartRemainSec = AgStt.CTHeartMaxSeconds;
            etcInfoObj.DtHeart        = Ag.Now();

            UpdateEtcInfoObj("Parsing ..  JsonNull");
        }
        else
        {
            try {
                (header + "   etcInfo  :  " + pData ["etcInfo"]).HtLog();
                //etcInfoObj = JsonMapper.ToObject<WasUserEtcInfo> (pData ["etcInfo"].ToJson ().RecoverFromDodge ().RemoveHeadFootOneChar ());
                etcInfoObj = new WasUserEtcInfo();
                etcInfoObj.Parse(JSON.Parse(pData ["etcInfo"].ToString().RecoverFromDodge().RemoveHeadFootOneChar()));
                etcInfoObj.ShowMyself();
            } catch {
                Ag.LogIntenseWord(" [< AmUserNet.cs >]       Parse etc Info >>>>>  E R R O R  ::  Read etcInfo  ");
            }
        }
        try {
            ("  My Rank : " + pData ["myRank"].ToString()).HtLog();
            myRank = new Rank(pData ["myRank"]);  // JsonMapper.ToObject<WasRank> (pData ["myRank"].ToJson ()); //.HtLog ();
        } catch {
            Ag.LogIntenseWord(" [< AmUserNet.cs >]       Parse Rank   >>>>>  E R R O R  :: ");
        }
        //Ag.LogString (" FreeCoupon ::   " + WAS.freeCouponDate + "   Length : " + WAS.freeCouponDate.Length);

        //FreeCouponLimitDT = WAS.freeCouponDate.ToDateTime ();
//        if (WAS.freeCouponDate.Length > 5) { // < 10) {
//            try {
//                FreeCouponLimitDT = WAS.freeCouponDate.ToDateTime ();
//            } catch {
//                FreeCouponLimitDT = DateTime.Now;
//            }
//        } else
//            FreeCouponLimitDT = DateTime.Now;

        Ag.LogString(header + WAS.TeamName + "     has      Cash : " + mCash1 + " / " + mCash2 + "         Gold : " + mGold +
                     "     Review : " + WAS.reviewEvent + "     Cost : " + WAS.Cost + "  in league : " + WAS.League);
        Ag.LogString(header + WAS.TeamName + "     etcInfo :: " + WAS.etcInfo);
        myRank.WAS.ShowMyself();
        Ag.LogIntense(2, false);
        return(true);
    }