protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginAnchorPos"))
     {
         BeginAnchorPos = JTweenUtils.JsonToVector3(json["beginAnchorPos"]);
     }
     // end if
     if (json.Contains("pos"))
     {
         m_posType     = PosTypeEnum.Pos;
         m_toAnchorPos = JTweenUtils.JsonToVector3(json["pos"]);
     }
     else if (json.Contains("posX"))
     {
         m_posType      = PosTypeEnum.PosX;
         m_toAnchorPosX = (float)json["posX"];
     }
     else if (json.Contains("posY"))
     {
         m_posType      = PosTypeEnum.PosY;
         m_toAnchorPosY = (float)json["posY"];
     }
     else if (json.Contains("posZ"))
     {
         m_posType      = PosTypeEnum.PosZ;
         m_toAnchorPosZ = (float)json["posZ"];
     }
     else
     {
         Debug.LogError(GetType().FullName + " JsonTo PosType is null");
     } // end if
     Restore();
 }
Ejemplo n.º 2
0
        private static MapEvent addSingleEventLogic(JsonData data, Dictionary <string, MapEvent> eventTable)
        {
            MapEvent me = null;

            if (data != null)
            {
                if (data.IsString)
                {
                    me = eventTable[(string)data];
                }
                else if (data.IsObject && data.Contains("事件"))
                {
                    me = eventTable[(string)data["事件"]];

                    if (data.Contains("前置与"))
                    {
                        foreach (JsonData eventName in data["前置与"])
                        {
                            me.conditionAndEvents.Add((string)eventName);
                        }
                    }

                    if (data.Contains("前置或"))
                    {
                        foreach (JsonData eventName in data["前置或"])
                        {
                            me.conditionOrEvents.Add((string)eventName);
                        }
                    }
                }
            }
            return(me);
        }
Ejemplo n.º 3
0
    private void LoadJson()
    {
        string jsonStr = btnDataJSON.text;

        if (jsonStr == null || jsonStr.Length == 0)
        {
            Debug.LogError("请检查按钮的JSON配置文件!" + gameObject.name);
            return;
        }

        JsonData jsonData = JsonMapper.ToObject(jsonStr);

        if (jsonData.Contains("地点") &&
            jsonData.Contains("背景") &&
            jsonData.Contains("介绍"))
        {
            place      = (string)jsonData["地点"];
            background = (string)jsonData["背景"];
            info       = (string)jsonData["介绍"];
        }
        else
        {
            Debug.LogError("JSON配置文件格式错误!" + gameObject.name);
        }
    }
Ejemplo n.º 4
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginPosition"))
     {
         BeginPosition = JTweenUtils.JsonToVector3(json["beginPosition"]);
     }
     // end if
     if (json.Contains("move"))
     {
         m_MoveType   = MoveTypeEnum.Move;
         m_toPosition = JTweenUtils.JsonToVector3(json["move"]);
     }
     else if (json.Contains("moveX"))
     {
         m_MoveType = MoveTypeEnum.MoveX;
         m_toMoveX  = (float)json["moveX"];
     }
     else if (json.Contains("moveY"))
     {
         m_MoveType = MoveTypeEnum.MoveY;
         m_toMoveY  = (float)json["moveY"];
     }
     else if (json.Contains("moveZ"))
     {
         m_MoveType = MoveTypeEnum.MoveZ;
         m_toMoveZ  = (float)json["moveZ"];
     }
     else
     {
         Debug.LogError(GetType().FullName + " JsonTo MoveType is null");
     } // end if
     Restore();
 }
Ejemplo n.º 5
0
        public ReasoningEvent(JsonData data)
        {
            id = (string)data["ID"];
            if (data.Contains("编号"))
            {
                num = (int)data["编号"];
            }
            question = (string)data["问题"];

            exit = data.Contains("出口") ? (string)data["出口"] : "";

            choice = new List <ReasoningChoice>();
            if (data.Contains("选项") && data["选项"] != null)
            {
                foreach (JsonData jd in data["选项"])
                {
                    choice.Add(new ReasoningChoice(jd));
                }
            }

            if (data.Contains("证据") && data["证据"] != null)
            {
                answerEvi = new ReasoningEvidence(data["证据"]);
            }
        }
Ejemplo n.º 6
0
    //private void OnGUI()
    //{
    //    if (GUI.Button(new Rect(0, 0, 400, 300), "xxxxxxxxx"))
    //    {
    //        Debug.Log("Button is Down!   ====== ");
    //        //Messenger.Broadcast<string, string[], Callback<string, JsonData>, bool, int>
    //        //    ("U2N_U_HTTP",
    //        //    "v1/node/newbie_guide_list.json",
    //        //    new string[] { "page_size=3" },
    //        //    delegate (string err, JsonData js)
    //        //    {
    //        //        debugstring = "err:" + err + "   js:" + js.ToString();
    //        //    }, false, 1);

    //        Messenger.AddListener<bool, string>("U2N_N_CloseLogin",
    //            delegate (bool b, string s) {
    //                debugstring = "err:" + b + "   js:" +s;
    //            });
    //        Messenger.Broadcast<Callback<bool, string>>("U2N_U_OpenLogin",null);
    //        //if (!_jd.Contains("data")) Debug.LogError("错误:U2N Native_CallBack 返回的参数必须有 data 字段。");
    //        //JsonData data = data = _jd["data"];
    //        //Messenger.Broadcast<bool, string>(fun, data["isOk"].Equals("0"), data["errorCode"].ToString());
    //    }
    //    GUI.Label(new Rect(0, 300, 400, 300), debugstring);
    //}


    #region 处理HTTP请求

    /// <summary>
    ///处理返回的http请求。
    /// </summary>
    /// <param name="jd"></param>
    /// <returns></returns>
    private bool UpdateRequestNativeHttp(JsonData jd)
    {
        if (jd["event"].Equals("Native_Http"))
        {
            if (!jd.Contains("ret_code"))
            {
                throw new System.Exception("错误:U2N NativeHttp_CallBack 返回的参数必须有 ret_code 字段");
            }
            if (!jd.Contains("fun"))
            {
                throw new System.Exception("错误:U2N NativeHttp_CallBack 返回的参数必须有 fun 字段");
            }

            if (m_http_requests.ContainsKey(jd["fun"].ToString()))
            {
                string err = null;
                if (jd["ret_code"].Equals("-1"))
                {
                    err = "用户认证失效,并且没有登录";
                }
                m_http_requests[jd["fun"].ToString()](err, jd["data"]);
            }
            return(true);
        }
        return(false);
    }
Ejemplo n.º 7
0
        public void authorizeToken(string token, authorizeToken_onCompleteCallback cb)
        {
            string url = Mobage.GetEnvironmentUrl(GameClient.appId) + "/oauth/authorize";

            NetworkQueue.Request req = new NetworkQueue.Request(url, "GET");
            req.OAuth(GameClient.consumerKey, GameClient.consumerSecret, this.oauthToken, this.oauthTokenSecret);
            req.body  = "authorize=1&id=012d521f-bc7f-40de-9124-2aa99b9bd334&oauth_token=" + token;
            req.trace = false;

            req.Callback(delegate(NetworkQueue.Response res) {
                if (res.error != null)
                {
                    cb(0, new Error(res.error), null);
                    return;
                }

                JsonData json = JsonMapper.ToObject(res.bodyString);

                if (!json.Contains("success") || !json.Contains("oauth_verifier"))
                {
                    cb(0, new Error("Missing fields from server response"), null);
                    return;
                }

                if (json["success"].GetBoolean() != true)
                {
                    cb(0, new Error("Success is false"), null);
                    return;
                }

                cb(0, null, json["oauth_verifier"].GetString());
            });

            NetworkQueue.instance.Enqueue(req);
        }
Ejemplo n.º 8
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginPivot"))
     {
         BeginPivot = JTweenUtils.JsonToVector2(json["beginPivot"]);
     }
     // end if
     if (json.Contains("pivot"))
     {
         m_pivotType = PivotTypeEnum.Pivot;
         m_toPivot   = JTweenUtils.JsonToVector2(json["pivot"]);
     }
     else if (json.Contains("pivotX"))
     {
         m_pivotType = PivotTypeEnum.PivotX;
         m_toPivotX  = (float)json["pivotX"];
     }
     else if (json.Contains("pivotY"))
     {
         m_pivotType = PivotTypeEnum.PivotY;
         m_toPivotY  = (float)json["pivotY"];
     }
     else
     {
         Debug.LogError(GetType().FullName + " JsonTo PivotType is null");
     } // end if
     Restore();
 }
Ejemplo n.º 9
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginStr"))
     {
         BeginStr = json["beginStr"].ToString();
     }
     // end if
     if (json.Contains("str"))
     {
         m_toStr = json["str"].ToString();
     }
     // end if
     if (json.Contains("rich"))
     {
         m_richTextEnabled = json["rich"].ToBool();
     }
     // end if
     if (json.Contains("mode"))
     {
         m_scrambleMode = (ScrambleMode)json["mode"].ToInt32();
     }
     // end if
     if (json.Contains("char"))
     {
         m_scrambleChars = json["char"].ToString();
     }
     // end if
     Restore();
 }
Ejemplo n.º 10
0
        public Negotiate(JsonData data)
        {
            UID = (int)data["UID"];

            isReply = false;
            if (data.Contains("主角发言"))
            {
                isReply = (bool)data["主角发言"];
            }

            content = (string)data["文字"];

            if (data.Contains("移动"))
            {
                move = (int)data["移动"];
            }

            if (data.Contains("后继"))
            {
                nextNum = (int)data["后继"];
            }

            nextSelect = new List <NegotiateSelection>();
            if (data.Contains("选项"))
            {
                foreach (JsonData i in data["选项"])
                {
                    nextSelect.Add(new NegotiateSelection(i));
                }
            }
        }
Ejemplo n.º 11
0
        public DetectPlaceSection(JsonData data)
        {
            place     = (string)data["地点"];
            imagename = (string)data["背景图片"];

            if (data.Contains("角色图片"))
            {
                charaimage = (string)data["角色图片"];
            }

            if (data.Contains("进入事件"))
            {
                entry = (string)data["进入事件"];
            }

            dialogs = new List <DetectDialog>();
            invests = new List <DetectInvest>();
            moves   = new List <string>();

            if (data.Contains("调查") &&
                data["调查"] != null &&
                data["调查"].Count > 0)
            {
                foreach (JsonData inv in data["调查"])
                {
                    invests.Add(new DetectInvest(inv));
                }
                //invests.Add(new DetectInvest(data["调查"]));
            }

            if (data.Contains("对话") &&
                data["对话"] != null &&
                data["对话"].Count > 0)
            {
                foreach (JsonData dia in data["对话"])
                {
                    dialogs.Add(new DetectDialog(dia));
                }
                //dialogs.Add(new DetectDialog(data["对话"]));
            }

            if (data.Contains("移动") &&
                data["移动"] != null &&
                data["移动"].Count > 0)
            {
                foreach (JsonData mov in data["移动"])
                {
                    moves.Add((string)mov);
                }
                //moves.Add((string)data["移动"]);
            }
        }
Ejemplo n.º 12
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginPixelRect"))
     {
         Vector4 rect = JTweenUtils.JsonToVector4(json["beginPixelRect"]);
         m_beginPixelRect = new Rect(rect.x, rect.y, rect.z, rect.w);
     } // end if
     if (json.Contains("pixelRect"))
     {
         Vector4 rect = JTweenUtils.JsonToVector4(json["pixelRect"]);
         m_toPixelRect = new Rect(rect.x, rect.y, rect.z, rect.w);
     } // end if
 }
Ejemplo n.º 13
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginColor"))
     {
         BeginColor = JTweenUtils.JsonToColor(json["beginColor"]);
     }
     // end if
     if (json.Contains("color"))
     {
         m_toColor = JTweenUtils.JsonToColor(json["color"]);
     }
     // end if
 }
Ejemplo n.º 14
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginFOV"))
     {
         m_beginFOV = (float)json["beginFOV"];
     }
     // end if
     if (json.Contains("FOV"))
     {
         m_toFOV = (float)json["FOV"];
     }
     // end if
     Restore();
 }
Ejemplo n.º 15
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginColor"))
     {
         BeginColor = JTweenUtils.JsonToColor(json["beginColor"]);
     }
     // end if
     if (json.Contains("alpha"))
     {
         m_toAlpha = (float)json["alpha"];
     }
     // end if
     Restore();
 }
Ejemplo n.º 16
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginPosition"))
     {
         BeginPosition = JTweenUtils.JsonToVector3(json["beginPosition"]);
     }
     // end if
     if (json.Contains("move"))
     {
         m_toPosition = JTweenUtils.JsonToVector3(json["move"]);
     }
     // end if
     Restore();
 }
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginScale"))
     {
         BeginScale = JTweenUtils.JsonToVector3(json["beginScale"]);
     }
     // end if
     if (json.Contains("scale"))
     {
         m_toScale = JTweenUtils.JsonToVector3(json["scale"]);
     }
     // end if
     Restore();
 }
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginStrength"))
     {
         BeginStrength = (float)json["beginStrength"];
     }
     // end if
     if (json.Contains("strength"))
     {
         m_toStrength = (float)json["strength"];
     }
     // end if
     Restore();
 }
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginVerticalPos"))
     {
         m_beginVerticalPos = json["beginVerticalPos"].ToFloat();
     }
     // end if
     if (json.Contains("vertical"))
     {
         m_toVerticalPos = json["vertical"].ToFloat();
     }
     // end if
     Restore();
 }
Ejemplo n.º 20
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginAnchorMin"))
     {
         BeginAnchorMin = JTweenUtils.JsonToVector2(json["beginAnchorMin"]);
     }
     // end if
     if (json.Contains("anchorMin"))
     {
         m_toAnchorMin = JTweenUtils.JsonToVector2(json["anchorMin"]);
     }
     // end if
     Restore();
 }
Ejemplo n.º 21
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginAspect"))
     {
         BeginAspect = (float)json["beginAspect"];
     }
     // end if
     if (json.Contains("aspect"))
     {
         m_toAspect = (float)json["aspect"];
     }
     // end if
     Restore();
 }
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginSizeDelta"))
     {
         BeginSizeDelta = JTweenUtils.JsonToVector2(json["beginSizeDelta"]);
     }
     // end if
     if (json.Contains("size"))
     {
         m_toSizeDelta = JTweenUtils.JsonToVector2(json["size"]);
     }
     // end if
     Restore();
 }
Ejemplo n.º 23
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginRotation"))
     {
         BeginRotation = (float)json["beginRotation"];
     }
     // end if
     if (json.Contains("angle"))
     {
         m_toAngle = (float)json["angle"];
     }
     // end if
     Restore();
 }
Ejemplo n.º 24
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginIntensity"))
     {
         BeginIntensity = (float)json["beginIntensity"];
     }
     // end if
     if (json.Contains("intensity"))
     {
         m_toIntensity = (float)json["intensity"];
     }
     // end if
     Restore();
 }
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginRotation"))
     {
         Vector4 quaternion = JTweenUtils.JsonToVector4(json["beginRotation"]);
         BeginRotation = new Quaternion(quaternion.x, quaternion.y, quaternion.z, quaternion.w);
     } // end if
     if (json.Contains("quaternion"))
     {
         Vector4 quaternion = JTweenUtils.JsonToVector4(json["quaternion"]);
         m_toRotate = new Quaternion(quaternion.x, quaternion.y, quaternion.z, quaternion.w);
     } // end if
     Restore();
 }
Ejemplo n.º 26
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginNCP"))
     {
         m_beginNCP = (float)json["beginNCP"];
     }
     // end if
     if (json.Contains("NCP"))
     {
         m_toNCP = (float)json["NCP"];
     }
     // end if
     Restore();
 }
Ejemplo n.º 27
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginOrthoSize"))
     {
         m_beginOrthoSize = (float)json["beginOrthoSize"];
     }
     // end if
     if (json.Contains("orthoSize"))
     {
         m_toOrthoSize = (float)json["orthoSize"];
     }
     // end if
     Restore();
 }
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginHorizontalPos"))
     {
         BeginHorizontalPos = json["beginHorizontalPos"].ToFloat();
     }
     // end if
     if (json.Contains("horizontal"))
     {
         m_toHorizontalPos = json["horizontal"].ToFloat();
     }
     // end if
     Restore();
 }
Ejemplo n.º 29
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginPitch"))
     {
         BeginPitch = (float)json["beginPitch"];
     }
     // end if
     if (json.Contains("pitch"))
     {
         m_toPitch = (float)json["pitch"];
     }
     // end if
     Restore();
 }
Ejemplo n.º 30
0
 protected override void JsonTo(JsonData json)
 {
     if (json.Contains("beginTime"))
     {
         BeginTime = (float)json["beginTime"];
     }
     // end if
     if (json.Contains("time"))
     {
         m_toTime = (float)json["time"];
     }
     // end if
     Restore();
 }