Exemplo n.º 1
0
 public WasObject()
 {
     messageAction = (int pInt) => {
         Ag.LogString(" WasObject :: Default messageAction ..  !!!  " + pInt.LogWith("Result"));
     };
     TpStr = this.GetType().ToString();
     StNet.AddWASJob2Thread(this);
 }
    // 1 : windows, 2 : iOS, 3 : android, 0 : unknown
    //  _////////////////////////////////////////////////_    _____   Main   _____   Methods   _____
    public override void SendAction()
    {
        AgStt.IntendedPause = false;

        AgStt.ReLoginAction();

        osType = 0;
        #if UNITY_IPHONE
        osType = 2;
        #endif
        #if UNITY_ANDROID
        osType = 3;
        #endif

        Ag.LogString("WasLogin :: SendAction ...   Started ...  ");
        SendStr = "";
        SendStr = SendStr.AddKeyValue("serviceCode", 100);

        SendStr = SendStr.AddKeyValue("userID", Ag.mGuest ? "" : User.WAS.KkoID);

        string str4key = Ag.mGuest ? User.DeviceID : User.WAS.KkoID;


//        int formatVer = 3;
//
//        string theKey = StcPlatform.TheToken;  // Kakao token ..
//        int formatVer = 2;
//        string theKey = StNet.GetEncodedPassword (str4key);

//        Ag.LogIntenseWord ("  The Token ::  " + theKey);

        /*
         *
         * string theKey = StcPlatform.TheToken;  // Kakao token ..
         */

        //        string theKey = StNet.GetEncodedPassword (str4key);
//
//        Ag.LogIntenseWord ("  The Token ::  " + theKey);

        int formatVer = 3;
        #if UNITY_EDITOR
        formatVer = 2;
        string theKey = StNet.GetEncodedPassword(str4key);
        #else
        formatVer = 3;
        SendStr   = SendStr.AddKeyValue("accessToken", StcPlatform.TheToken);
        Ag.LogIntenseWord("  The Token ::  " + StcPlatform.TheToken);
        #endif

        SendStr = SendStr.AddKeyValue("encodedPassword", StNet.GetEncodedPassword(str4key));
        SendStr = SendStr.AddKeyValue("formatVersion", formatVer);
        int userType = Ag.mGuest ? 0 : 1;
        //userType = Ag.mGuest && StNet.GuestUserType0Tried ? 1 : userType;

        SendStr = SendStr.AddKeyValue("userType", userType);

        SendStr = SendStr.AddKeyValue("osType", osType);
        SendStr = SendStr.AddKeyValue("osVersion", osVer);
        SendStr = SendStr.AddKeyValue("deviceModel", SystemInfo.deviceModel);
        SendStr = SendStr.AddKeyValue("deviceUUID", User.DeviceID, false);
        SendStr = SendStr.AddParen();

        postAction = () => {
            " post Action ".HtLog();
            User.WAS.WasKey     = NdObj ["key"];
            User.mServerNum     = NdObj ["svrVersion"].AsInt;
            User.noticeImageUrl = NdObj ["noticeImageUrl"];

            //
            if (NdObj ["result"].AsInt == -1)  // go to Regist ..
            {
                ;
            }

            // Server Version Check..
            int svrVersion = NdObj ["svrVersion"].AsInt;
//            if (AgStt.ClientVersion < svrVersion) // New client has come.. Go to App Store ..
//                AgStt.mURI = "http://221.143.21.33/api.psy.trd";
//            else if (svrVersion < AgStt.ClientVersion) // Review
//                AgStt.mURI = "http://221.143.21.33/api.psy.trd";
//            else // same version  Service ..
//                AgStt.mURI = "http://221.143.21.33/api.psy.trd";

            try {
                User.TimeEventEnd = NdObj ["timeEventEndDate"].ToString().ToDateTime();
            } catch {
                " No timeEventEndDate ....  ".HtLog();
            }
            User.loginCount = NdObj ["loginCount"].AsInt;
            messageAction(Result.result); // 0 : 성공, -1 : 중복, -2 : 허용 불가 이름, 1: 존재하지 않는 사용자
            (User.mServerNum.LogWith("svrVersion") + User.WAS.WasKey.LogWith("key") + User.noticeImageUrl.LogWith("notiURL")).HtLog();
            (User.TimeEventEnd.ToString().LogWith("TimeEvent") + User.ServerVer.LogWith("Svr Ver")).HtLog();
        };

        SendAndRciv();
    }