Example #1
0
        public static void RequestEndedCallBack(CIRequest request, string response)
        {
            BaseCallbackInfo info = new BaseCallbackInfo();

            info.customcallback = request.customcallback;
            info.signature      = request.sign;
            info.jsonresult     = response;

            Debug.Log(response);

            request.cb(info);
        }
Example #2
0
        public static void sdkResponse(BaseCallbackInfo ininfo)
        {
            ColibryEntities curentity = null;

            if (EntitiesDictionary.ContainsKey(GetFirstPartSign(ininfo.signature)))
            {
                curentity = EntitiesDictionary[GetFirstPartSign(ininfo.signature)] as ColibryEntities;
                curentity.sdkResponseCustom(ininfo);
            }
            else
            {
                Debug.Log("Invalid Signature!!!");
            }
        }
Example #3
0
        private void sdkResponseCustom(BaseCallbackInfo ininfo)
        {
            JSON root = new JSON();

            root.serialized = ininfo.jsonresult;
            bool infoerror = false;

            //есть ошибки
            if (root.fields.ContainsKey("error"))
            {
                infoerror = true;
            }

            if (infoerror)
            {
                errorResponse(root);
            }
            else
            {
                if (ininfo.signature == ColibryIapRequestSigns.TEST_PURCHASE_IOS)
                {
                    if (!root.fields.ContainsKey("status") || root.ToInt("status") != 0)
                    {
                        infoerror = true;
                    }
                    testpurchaseiOSResponse(root);
                }


                if (ininfo.signature == ColibryIapRequestSigns.TEST_PURCHASE_ANDROID)
                {
                    if (!root.fields.ContainsKey("status") || root.ToInt("status") != 0)
                    {
                        infoerror = true;
                    }
                    testpurchaseAndroidResponse(root);
                }
            }


            for (int i = 0; i < delegatesArray.Count; i++)
            {
                ((SDKCoreDelegate)delegatesArray[i]).sdkResponse(ininfo);
            }

            if (ininfo.customcallback != null)
            {
                ininfo.customcallback(ininfo.signature, root.serialized, infoerror);
            }
        }
Example #4
0
        private void sdkResponseCustom(BaseCallbackInfo ininfo)
        {
            string clearedsignature = GetClearedSign(ininfo.signature);

            string objecthashcode = GetFirstPartSign(clearedsignature);

            //isobjectsignature
            if (objecthashcode != "")
            {
                clearedsignature = RemoveFirstPartSign(clearedsignature);
            }
            //Debug.Log ("ininfo.sign="+ininfo.signature);
            //Debug.Log ("clearedsignature="+clearedsignature);
            //Debug.Log ("objecthashcode="+objecthashcode);

            JSON root = new JSON();

            root.serialized = ininfo.jsonresult;
            bool infoerror = false;

            //есть ошибки
            if (root.fields.ContainsKey("error"))
            {
                infoerror = true;
            }

            if (infoerror)
            {
                errorResponse(root);
            }
            else
            {
                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_CREATE)
                {
                    entitycreateResponse(root, ininfo.signature);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_FIND)
                {
                    entityfindResponse(root, objecthashcode);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_SAVE)
                {
                    entitysaveResponse(root, objecthashcode);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_SET)
                {
                    entitysetResponse(root, objecthashcode);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_UNSET)
                {
                    entityunsetResponse(root, objecthashcode);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_GET)
                {
                    entitygetResponse(root, objecthashcode);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_PUSH)
                {
                    entitypushResponse(root, objecthashcode);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_PULL)
                {
                    entitypullResponse(root, objecthashcode);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITIES_FIND)
                {
                    entitiesfindResponse(root);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITIES_CREATE)
                {
                    entitiescreateResponse(root);
                }

                if (clearedsignature == ColibryEntitiesRequestSigns.ENTITY_DELETE)
                {
                    entitydeleteResponse(root, objecthashcode);
                }
            }

            for (int i = 0; i < delegatesArray.Count; i++)
            {
                ((SDKCoreDelegate)delegatesArray[i]).sdkResponse(ininfo);
            }

            if (ininfo.customcallback != null)
            {
                ininfo.customcallback(clearedsignature, root.serialized, infoerror);
            }
        }
Example #5
0
 public static void sdkResponse(BaseCallbackInfo ininfo)
 {
     _instance.sdkResponseCustom(ininfo);
 }
Example #6
0
        public void sdkResponseCustom(BaseCallbackInfo ininfo)
        {
            JSON root = new JSON();

            root.serialized = ininfo.jsonresult;
            bool infoerror = false;

            //есть ошибки
            if (root.fields.ContainsKey("error"))
            {
                infoerror = true;
            }

            if (infoerror)
            {
                errorResponse(root);
            }
            else
            {
                if (ininfo.signature == ColibryUserRequestSigns.SIGN_UP)
                {
                    signUpResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.SIGN_IN)
                {
                    signInResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.SIGN_OUT)
                {
                    signInResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.SAVE_USER)
                {
                    saveUserResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.LOAD_USER)
                {
                    loadUserResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.USERS_FIND)
                {
                    usersfindResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.SET_VALUE)
                {
                    setValueResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.GET_VALUE)
                {
                    getValueResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.PUSH)
                {
                    pushResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.PULL)
                {
                    pullResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.DELETE_USER)
                {
                    deleteUserResponse(root);
                }

                if (ininfo.signature == ColibryUserRequestSigns.SIGN_ADD)
                {
                    signaddResponse(root);
                }
            }


            for (int i = 0; i < delegatesArray.Count; i++)
            {
                ((SDKCoreDelegate)delegatesArray[i]).sdkResponse(ininfo);
            }

            if (ininfo.customcallback != null)
            {
                ininfo.customcallback(ininfo.signature, root.serialized, infoerror);
            }
        }