상속: MonoBehaviour
    private List<Item> ItemsToFileJSon(JsonData sourceData)
    {
        int LengthData = sourceData.Count;
        List<Item> itemsToGetted = new List<Item>();

        for (int i = 0; i < LengthData; i++)
        {
            Item itemGettedTmp = new Item()
            {
                Id = (int)sourceData[i]["Id"],
                Name = sourceData[i]["Name"].ToString(),
                Description = sourceData[i]["Description"].ToString(),
                Intensity = (int)sourceData[i]["Intensity"],
                TypeItem = (e_itemType)((int)sourceData[i]["Type"]),
                ElementTarget = (e_element)((int)sourceData[i]["Element"]),
                LevelRarity = (e_itemRarity)((int)sourceData[i]["Rarity"]),
                IsStackable = (bool)sourceData[i]["Stackable"],
                Sprite = Item.AssignResources(sourceData[i]["Sprite"].ToString())
            };

            itemsToGetted.Add(itemGettedTmp);
        }

        return itemsToGetted;
    }
예제 #2
0
파일: Settings.cs 프로젝트: clomax/evosim
 public Settings()
 {
     sr = new StreamReader(Application.dataPath + "/" + settings_file);
     raw_contents = sr.ReadToEnd();
     contents = JsonMapper.ToObject(raw_contents);
     sr.Close();
 }
예제 #3
0
 /// <summary>
 /// Constructs on operation from a service model, operation name, and the json model
 /// </summary>
 /// <param name="model">The model of the service the operation belongs to</param>
 /// <param name="name">The name of the operation</param>
 /// <param name="data">The json data from the model file</param>
 public Operation(ServiceModel model, string name, JsonData data)
     : base(model, data)
 {
     this.model = model;
     this.name = name;
     this.data = data;
 }
예제 #4
0
    // 初始化部件列表, 同时初始化第一种部件类型的清单列表(包括图标和文字)
    public void InitializeList(JsonData data)
    {
        ClearAll ();
        JsonData jsonArray = data["data_list"];
        for (int i = 0; i < jsonArray.Count; i++) {
            GameObject item = GameObject.FindGameObjectWithTag("componentitem");
            GameObject newItem = Instantiate(item) as GameObject;
            newItem.GetComponent<ComponentItem>().componentId = (int)jsonArray[i]["id"];
            newItem.GetComponent<ComponentItem>().componentName = jsonArray[i]["name"].ToString();
            newItem.GetComponent<ComponentItem>().componentLabel.text = jsonArray[i]["name"].ToString();
            newItem.GetComponent<ComponentItem>().name = jsonArray[i]["name"].ToString();
            newItem.GetComponent<RectTransform>().localScale = Vector3.one;
            newItem.transform.SetParent (gridLayout.transform);
            newItem.GetComponent<RectTransform>().localScale = newItem.transform.parent.localScale;
            componentItems.Add(newItem);
            Color temp = newItem.GetComponent<ComponentItem>().triangle.color;
            if (i == 0) {
                temp.a = 255f;
            } else {
                temp.a = 0f;
            }
            newItem.GetComponent<ComponentItem>().triangle.color = temp;

            newItem.SetActive (true);
        }
        SetContentWidth ();
        if (jsonArray.Count > 0) {
            WWWForm wwwForm = new WWWForm();
            wwwForm.AddField("api_type", 3);
            wwwForm.AddField("id", (int)jsonArray[0]["id"]);
            GetComponent<HttpServer>().SendRequest(Constant.ReuestUrl, wwwForm, new HttpServer.GetJson(typeScrollView.InitializeList));
        }
    }
예제 #5
0
 // Use this for initialization
 void Start()
 {
     next = -1;
     dataFile = loadJSON.Instance.loadFile (level);
     //GameObject player = GameObject.Find ("player");
     //player.GetComponent<playerTalk> ().missionData=dataFile;
 }
예제 #6
0
        private static Statement convertStatement(JsonData jStatement)
        {
            if (jStatement[JsonDocumentFields.STATEMENT_EFFECT] == null || !jStatement[JsonDocumentFields.STATEMENT_EFFECT].IsString)
                return null;


            string jEffect = (string)jStatement[JsonDocumentFields.STATEMENT_EFFECT];
            Statement.StatementEffect effect;
            if (JsonDocumentFields.EFFECT_VALUE_ALLOW.Equals(jEffect))
                effect = Statement.StatementEffect.Allow;
            else
                effect = Statement.StatementEffect.Deny;

            Statement statement = new Statement(effect);

            if (jStatement[JsonDocumentFields.STATEMENT_ID] != null && jStatement[JsonDocumentFields.STATEMENT_ID].IsString)
                statement.Id = (string)jStatement[JsonDocumentFields.STATEMENT_ID];

            convertActions(statement, jStatement);
            convertResources(statement, jStatement);
            convertCondition(statement, jStatement);
            convertPrincipals(statement, jStatement);

            return statement;
        }
예제 #7
0
        protected override void DoRequest(AjaxContext context, JsonData input, JsonData output)
        {
            // get...
            AjaxValidator validator = new AjaxValidator();
            string username = validator.GetRequiredString(input, "username");
            string password = validator.GetRequiredString(input, "password");

            // ok?
            if (validator.IsOk)
            {
                // get...
                User user = User.GetByUsername(context, username);
                if (user != null)
                {
                    // check...
                    if (user.CheckPassword(password))
                    {
                        // create an access token...
                        Token token = Token.CreateToken(context, user);
                        if (token == null)
                            throw new InvalidOperationException("'token' is null.");

                        // set...
                        output["token"] = token.TheToken;
                    }
                    else
                        validator.AddError("Password is invalid.");
                }
                else
                    validator.AddError("Username is invalid.");
            }

            // set...
            validator.Apply(output);
        }
예제 #8
0
 public JsonData MapToData(Map map)
 {
     JsonData data = new JsonData ();
     data ["Name"] = map.mapname;
     data ["Step"] = map.PerfectMove;
     data ["Width"] = map.width;
     data ["Height"] = map.height;
     data["Grid"]=new JsonData();
     JsonData AGD = new JsonData ();
     for(int i=0;i<GridPos.Count;i++){
         JsonData gd=new JsonData();
         gd["x"]=GridPos[i].x;
         gd["y"]=GridPos[i].y;
         gd["data"]=new JsonData();
         gd["data"].Add ((int)GData[i].type);
         gd["data"].Add ((int)GData[i].color);
         gd["data"].Add ((int)GData[i].ObjectSide);
         AGD.Add (gd);
     }
     data ["Grid"] = AGD;
     data ["Block"] = new JsonData ();
     JsonData ABD = new JsonData ();
     for(int i=0;i<AllBlock.Count;i++){
         JsonData bd=new JsonData();
         bd["x"]=AllBlock[i].x;
         bd["y"]=AllBlock[i].y;
         ABD.Add (bd);
     }
     if (!ABD.IsObject)
         ABD.Add (null);
     data ["Block"] = ABD;
     return data;
 }
예제 #9
0
        public void ProcessRequest(HttpContext context)
        {
            string json = null;
            using (Stream stream = context.Request.InputStream)
            {
                StreamReader reader = new StreamReader(stream);
                json = reader.ReadToEnd();
            }

            // load...
            JsonData input = new JsonData(json);
            JsonData output = new JsonData();
            try
            {
                DoRequest(input, output);

                // did we get output?
                if (!(output.ContainsKey("isOk")))
                    output["isOk"] = true;
            }
            catch(Exception ex)
            {
                output["isOk"] = false;
                output["error"] = "General failure.";
                output["generalFailure"] = ex.ToString();
            }

            // jqm access control bits...
            context.Response.AddHeader("Access-Control-Allow-Origin", "*");
            context.Response.AddHeader("Access-Control-Allow-Methods", "POST, GET");

            // send...
            context.Response.ContentType = "text/json";
            context.Response.Write(output.ToString());
        }
예제 #10
0
    public void SortAndSend(JsonData[] ssObjects)
    {
        OptionalMiddleStruct container = new OptionalMiddleStruct();
        //int score = 0;

        // Break apart data and test it against current score
        for (int i = 0; i < ssObjects.Length; i++)
        {
            container.place = ssObjects[i]["place"].ToString();
            container.name = ssObjects[i]["name"].ToString();
            container.score = int.Parse(ssObjects[i]["score"].ToString());

            //Debug.Log("Checking.........");
            // if current score is higher than 
            if (EndlessPlayerController.Score >= container.score)
            {
                container.score = EndlessPlayerController.Score;
               // Debug.Log("You've beaten a global high score!");

                _PanelToDeactivate = GameObject.FindGameObjectWithTag("HUDPanel");
                _PanelToDeactivate.SetActive(false);
                _UniversalScorePanel.SetActive(true);
                containerToSend = container; // add to external container in preparation to send
                
                EndlessGameInfo._AllowGlobalHighScore = true;
                break;
            }                
        }        
    }
예제 #11
0
 public Map DataToMap(JsonData Data)
 {
     mapname = Data ["Name"].ToString ();
     PerfectMove = int.Parse (Data ["Step"].ToString ());
     width= int.Parse (Data ["Width"].ToString ());
     height= int.Parse (Data ["Height"].ToString ());
     for(int i=0;i<Data["Grid"].Count;i++) {
         JsonData jd=Data["Grid"][i];
         GridPos.Add (new Vector2(float.Parse (jd["x"].ToString ()),float.Parse (jd["y"].ToString ())));
         GridData d=new GridData(int.Parse(jd["data"][0].ToString ()),int.Parse(jd["data"][1].ToString ()),int.Parse(jd["data"][2].ToString ()));
         GData.Add (d);
     }
     for(int i=0;i<Data["Block"].Count;i++)
     {
         JsonData jd=Data["Block"][i];
         if(jd==null)
             break;
         AllBlock.Add (new Vector2(float.Parse (jd["x"].ToString ()),float.Parse (jd["y"].ToString ())));
     }
     GPD = new Dictionary<Vector2, GridData> ();
     for (int i=0; i<GridPos.Count; i++) {
         GPD.Add (GridPos[i],GData[i]);
     }
     return this;
 }
예제 #12
0
    protected override void AppendParameters(JsonData parameters)
    {
        base.AppendParameters(parameters);

        parameters["mob_id"] = MobId;
        parameters["killer_character_id"] = KillerCharacterId;
    }
예제 #13
0
    protected override void ParseParameters(JsonData parameters)
    {
        base.ParseParameters(parameters);

        MobId = JsonUtilities.ParseInt(parameters, "mob_id");
        KillerCharacterId = JsonUtilities.ParseInt(parameters, "killer_character_id");
    }
예제 #14
0
        internal AjaxContext(JsonData input)
        {
            // get the api out...
            string apiKey = input.GetValueSafe<string>("apiKey");
            if (string.IsNullOrEmpty(apiKey))
                throw new InvalidOperationException("The 'apiKey' value was not specified in the request.");
            this.ApiUser = ApiUser.GetOrCreateApiUser(new Guid(apiKey));
            if(ApiUser == null)
                throw new InvalidOperationException("'ApiUser' is null.");

            // do we have a logon token?
            string asString = input.GetValueSafe<string>("logonToken");
            if (!(string.IsNullOrEmpty(asString)))
            {
                Token token = Token.GetByToken(this.ApiUser, asString);
                if (token == null)
                    throw new InvalidOperationException(string.Format("A token with ID '{0}' was not found.", asString));

                // update...
                token.UpdateExpiration();

                // set...
                this.Token = token;
            }
        }
예제 #15
0
        public ActionResult CheckUser(ClientUserLoginModel model)
        {
            var re = new JsonData<int>();
            try
            {
                var user = _accountService.GetAllAccounts().FirstOrDefault(u => u.AccountName == model.LoginName);
                if (user != null)
                {
                    var encryptionPassword = _encryption.GetBase64Hash(System.Text.Encoding.UTF8.GetBytes(model.Password.ToCharArray()));
                    if (string.Compare(encryptionPassword, user.Password, false, System.Globalization.CultureInfo.InvariantCulture) == 0)
                    {
                        re.d=user.Id;
                    }
                    else
                        re.m="密码错误!";
                }
                else
                {
                    re.m = "登录名不存在!";
                }

                return Json(re);
            }
            catch (Exception ex)
            {
                Response.StatusCode = 500;
                return Json(ex.Message);
            }
        }
예제 #16
0
        public static ChatResponse Parse(JsonData data)
        {
            if (data == null || !data.Has("id") || !data.Has("type"))
            {
                return null;
            }

            var chatResponse = new ChatResponse
            {
                Id = data.Get<int>("id"),
                Title = data.Get<string>("title"),
                UserName = data.Get<string>("username"),
                FirstName = data.Get<string>("first_name"),
                LastName = data.Get<string>("last_name")
            };

            switch (data.Get<string>("type"))
            {
                case "private":
                    chatResponse.Type = ChatType.Private;
                    break;

                case "group":
                    chatResponse.Type = ChatType.Group;
                    break;

                case "channel":
                    chatResponse.Type = ChatType.Channel;
                    break;
            }

            return chatResponse;
        }
예제 #17
0
    private void OnDownloadComplete(string worksheetName, JsonData[] data, string error)
    {
        if (m_WorksheetName == worksheetName)
        {
            if (!string.IsNullOrEmpty(error))
            {
                if (m_ProgressImage != null)
                {
                    m_ProgressImage.fillAmount = 0;
                }

                if (m_ProgressText != null)
                {
                    m_ProgressText.text = "ERROR";
                }
                Debug.Log("Download error on: " + m_WorksheetName + " - " + error);
            }
            else
            {
                if (m_ProgressImage != null)
                {
                    m_ProgressImage.fillAmount = 1;
                }

                if (m_ProgressText != null)
                {
                    m_ProgressText.text = 100.ToString("00.00");
                }
                Debug.Log("Download complete on: " + m_WorksheetName + " - " + JsonMapper.ToJson(data));
            }
        }
    }
예제 #18
0
 BufferData(JsonData _item)
 {
     try
     {
         JsonData item = _item;
         ID = int.Parse(item["ID"].ToString());
         Probability = float.Parse(item["Probability"].ToString());
         Type = (BufferType)Enum.Parse(typeof(BufferType), item["BufferType"].ToString());
         IsBuff = bool.Parse(item["IsBuff"].ToString());
         IsDeBuff = bool.Parse(item["IsDeBuff"].ToString());
         Duration = float.Parse(item["Duration"].ToString());
         Circle = float.Parse(item["Circle"].ToString());
         IniTrigger = bool.Parse(item["IniTrigger"].ToString());
         TriggerExecute = item["TriggerExecute"].ToString();
         Stackable = bool.Parse(item["Stackable"].ToString());
         MaxStack = int.Parse(item["MaxStack"].ToString());
         PAttack = int.Parse(item["PAttack"].ToString());
         PLethalityRate = float.Parse(item["PLethalityRate"].ToString());
         MAttack = int.Parse(item["MAttack"].ToString());
         MLethalityRate = float.Parse(item["MLethalityRate"].ToString());
         PDefense = int.Parse(item["PDefense"].ToString());
         PResistanceRate = float.Parse(item["PResistanceRate"].ToString());
         MDefense = int.Parse(item["MDefense"].ToString());
         MResistanceRate = float.Parse(item["MResistanceRate"].ToString());
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }
예제 #19
0
 //remove till here after testing.........................................
 //Enable this part after testing.................................................................
 //void Start()
 //{
 //    Application.ExternalCall("MyFunction2", "Hello from Unity!");
 //}
 ////pass surveyId to game from index.html
 //public void ConnectWithServer(string sid)
 //{
 //    Debug.Log("sid received:" + sid);
 //    SavingData.sid = sid;
 //    if (sid != null)
 //    {
 //        saveData.createData(true);
 //    }
 //    else
 //    {
 //        Debug.Log("nothing passed");
 //    }
 //}
 ////passing json to game from index.hmtl
 //public IEnumerator MyFunction(string param)
 //{
 //    Debug.Log("json link received:" + param);
 //    if (param != null)
 //    {
 //        //Debug.Log("null");
 //        //jsonQuestions = JsonMapper.ToObject(param);
 //        url = param;
 //        WWW www = new WWW(url);
 //        yield return www;
 //        ProcessSurvey(www.text);
 //    }
 //    else
 //    {
 //        Debug.Log("nothing passed");
 //    }
 //}
 //Till here.......................................................................................
 public void ProcessSurvey(string jsonString)
 {
     jsonQuestions = JsonMapper.ToObject(jsonString);
     //Debug.Log(jsonQuestions["fields"].Count);
     //Debug.Log(jsonQuestions["game_title"].ToString());
     Invoke("loadGame",3.5f);//remove it after adding assetBundle load
 }
 String_AttributeData(JsonData _item)
 {
     try
     {
         JsonData item = _item;
         foreach (string key in item.Keys)
         {
             switch (key)
             {
                 case "Name":
                     Name = item[key].ToString();
                     break;
                 case "ZH-TW":
                     ZH_TW = item[key].ToString();
                     break;
                 case "ZH-CN":
                     ZH_CN = item[key].ToString();
                     break;
                 case "EN":
                     EN = item[key].ToString();
                     break;
                 default:
                     Debug.LogWarning(string.Format("String_Attribute表有不明屬性:{0}", key));
                     break;
             }
         }
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }
    protected override void ParseParameters(JsonData parameters)
    {
        base.ParseParameters(parameters);

        CharacterId = (int)parameters["character_id"];
        MobId = (int)parameters["mob_id"];
    }
예제 #22
0
 SpriteData(JsonData _item)
 {
     try
     {
         JsonData item = _item;
         foreach (string key in item.Keys)
         {
             switch (key)
             {
                 case "Name":
                     Name = item[key].ToString();
                     break;
                 case "Path":
                     Path = item[key].ToString();
                     break;
                 default:
                     Debug.LogWarning(string.Format("Sprite表有不明屬性:{0}", key));
                     break;
             }
         }
         SetSprite();
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }
예제 #23
0
 LevelData(JsonData _item)
 {
     try
     {
         JsonData item = _item;
         foreach (string key in item.Keys)
         {
             switch (key)
             {
                 case "Level":
                     Level = int.Parse(item[key].ToString());
                     break;
                 case "NeedExp":
                     NeedExp = int.Parse(item[key].ToString());
                     break;
                 case "Point":
                     Point = int.Parse(item[key].ToString());
                     break;
                 default:
                     Debug.LogWarning(string.Format("Level表有不明屬性:{0}", key));
                     break;
             }
         }
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
     }
 }
예제 #24
0
파일: _UITools.cs 프로젝트: liuhanxu/LHJ
	/// <summary>
	/// Loops the children.
	/// </summary>
	/// <returns>The children.</returns>
	/// <param name="t">T.</param>
	private static JsonData LoopChildren(Transform t)
	{
		RectTransform rt = (RectTransform)t;

		JsonData jd = new JsonData ();
		jd ["name"] = t.name;
		JsonData trJD = new JsonData ();
		trJD ["position"] = rt.anchoredPosition.VectorToJson ();
		trJD ["sizeDelta"] = rt.sizeDelta.VectorToJson ();
		trJD ["anchorMin"] = rt.anchorMin.VectorToJson ();
		trJD ["anchorMax"] = rt.anchorMax.VectorToJson ();
		trJD ["pivot"] = rt.pivot.VectorToJson ();
		trJD ["rotation"] = rt.rotation.eulerAngles.VectorToJson ();
		trJD ["scale"] = rt.localScale.VectorToJson ();
		jd ["transform"] = trJD;

		int len = t.childCount;
		JsonData ch = new JsonData ();
		for (int i = 0; i < len; ++i) {
			ch.Add(LoopChildren (t.GetChild (i)));
		}
		string jsStr = JsonMapper.ToJson (ch);
		jd ["children"] = string.IsNullOrEmpty(jsStr)?"[]":ch;

		return jd;
	}
예제 #25
0
        public void TestGetReportsByUser()
        {
            ResetReports();

            // create some reports..
            User user = this.Creator.CreateUser();
            Report report1 = this.Creator.CreateReport(user);
            Report report2 = this.Creator.CreateReport(user);
            Report report3 = this.Creator.CreateReport(user);
            Report report4 = this.Creator.CreateReport(user);
            Report report5 = this.Creator.CreateReport(user);

            // get...
            HandleGetReportsByUser handler = new HandleGetReportsByUser();
            JsonData output = new JsonData();
            handler.DoRequest(this.CreateJsonData(user), output);

            // check...
            string asString = output.GetValueSafe<string>("reports");
            IList reports = (IList)new JavaScriptSerializer().DeserializeObject(asString);
            Assert.AreEqual(5, reports.Count);

            // check...
            Assert.AreEqual(this.ApiKey, ((IDictionary)reports[0])["apiKey"]);
            Assert.AreEqual(user.IdAsString, ((IDictionary)reports[0])["ownerUserId"]);
            Assert.AreEqual(this.ApiKey, ((IDictionary)reports[1])["apiKey"]);
            Assert.AreEqual(user.IdAsString, ((IDictionary)reports[1])["ownerUserId"]);
            Assert.AreEqual(this.ApiKey, ((IDictionary)reports[2])["apiKey"]);
            Assert.AreEqual(user.IdAsString, ((IDictionary)reports[2])["ownerUserId"]);
            Assert.AreEqual(this.ApiKey, ((IDictionary)reports[3])["apiKey"]);
            Assert.AreEqual(user.IdAsString, ((IDictionary)reports[3])["ownerUserId"]);
            Assert.AreEqual(this.ApiKey, ((IDictionary)reports[4])["apiKey"]);
            Assert.AreEqual(user.IdAsString, ((IDictionary)reports[4])["ownerUserId"]);
        }
예제 #26
0
    public static JsonData CreateJoinMsgJson()
    {
        JsonData ret = new JsonData (JsonType.Object);
        ret ["msg_type"] = MSG_R_ClientJoinWithConfig;
        JsonData config = new JsonData (JsonType.Object);
        config["environment_scene"] = "ProceduralGeneration";
        config["random_seed"] = 1; // Omit and it will just choose one at random. Chosen seeds are output into the log(under warning or log level)."should_use_standardized_size": False,
        config["standardized_size"] =  new Vector3(1.0f, 1.0f, 1.0f).ToJson();
        config["disabled_items"] = new JsonData(JsonType.Array); //["SQUIRL", "SNAIL", "STEGOSRS"], // A list of item names to not use, e.g. ["lamp", "bed"] would exclude files with the word "lamp" or "bed" in their file path
        config["permitted_items"] = new JsonData(JsonType.Array); //["bed1", "sofa_blue", "lamp"],
        config["complexity"] = 7500;
        config["num_ceiling_lights"] = 4;
        config["minimum_stacking_base_objects"] = 15;
        config["minimum_objects_to_stack"] = 100;
        config["room_width"] = 40.0f;
        config["room_height"] = 15.0f;
        config["room_length"] = 40.0f;
        config["wall_width"] = 1.0f;
        config["door_width"] = 1.5f;
        config["door_height"] = 3.0f;
        config["window_size_width"] = 5.0f;
        config["window_size_height"] = 5.0f;
        config["window_placement_height"] = 5.0f;
        config["window_spacing"] = 10.0f;  // Average spacing between windows on walls
        config["wall_trim_height"] = 0.5f;
        config["wall_trim_thickness"] = 0.01f;
        config["min_hallway_width"] = 5.0f;
        config["number_rooms"] = 1;
        config["max_wall_twists"] = 3;
        config["max_placement_attempts"] = 300;   // Maximum number of failed placements before we consider a room fully filled.
        config["grid_size"] = 0.4f;    // Determines how fine tuned a grid the objects are placed on during Proc. Gen. Smaller the number, the

        ret["config"] = config;
        return ret;
    }
예제 #27
0
 public MachineInfo(JsonData data)
 {
     ParseSlots(data["slots"]);
     ParseReels((IList)data["reels"]);
     ParseLines((IList)data["lines"]);
     ParsePayouts((IList)data["payouts"]);
 }
예제 #28
0
    void Start()
    {
        #if UNITY_IPHONE
        //ReportPolicy
        //REALTIME = 0,       //send log when log created
        //BATCH = 1,          //send log when app launch
        //SENDDAILY = 4,      //send log every day's first launch
        //SENDWIFIONLY = 5    //send log when wifi connected

        MobclickAgent.StartWithAppKeyAndReportPolicyAndChannelId("4f3122f152701529bb000042",0,"Develop");
        MobclickAgent.SetAppVersion("1.2.1");
        MobclickAgent.SetLogSendInterval(20);
        JsonData eventAttributes = new JsonData();
        eventAttributes["username"] = "******";
        eventAttributes["company"] = "Umeng Inc.";

        MobclickAgent.EventWithAttributes("GameState",JsonMapper.ToJson(eventAttributes));
        MobclickAgent.SetLogEnabled(true);
        MobclickAgent.SetCrashReportEnabled(true);
        MobclickAgent.CheckUpdate();
        MobclickAgent.UpdateOnlineConfig();
        MobclickAgent.Event("GameState");
        MobclickAgent.BeginEventWithLabel("New-GameState","identifierID");
        MobclickAgent.EndEventWithLabel("New-GameState","identifierID");
        #elif UNITY_ANDROID
        MobclickAgent.setLogEnabled(true);

        MobclickAgent.onResume();

        // Android: can't call onEvent just before onResume is called, 'can't call onEvent before session is initialized' will be print in eclipse logcat
        // Android: call MobclickAgent.onPause(); when Application exit.
        #endif
    }
예제 #29
0
 public object UICall(JsonData data)
 {
     string name = data["name"].ToString();
     string method = data["method"].ToString();
     JsonData arg_data = data["args"];
     object[] args = new object[arg_data.Count];
     for (int i = 0; i < arg_data.Count; i++)
     {
         JsonData d = arg_data[i];
         if (d.IsString) { args[i] = (string)d; continue; }
         if (d.IsBoolean) { args[i] = (bool)d; continue; }
         if (d.IsDouble) { args[i] = (double)d; continue; }
         if (d.IsInt) { args[i] = (int)d; continue; }
         if (d.IsLong) { args[i] = (long)d; continue; }
         if (d.IsArray) { args[i] = d; continue; }
         if (d.IsObject) { args[i] = d; continue; }
     }
     Component ui = UIManager.instance.Find(name);
     if (ui == null)
     {
         Debug.LogError("UICall: can not find the ui:" + name);
         return null;
     }
     try
     {
         object result = Type.GetType(name).InvokeMember(method, BindingFlags.InvokeMethod, null, ui, args);
         if (result != null) return result;
     }
     catch (Exception ex)
     {
         Debug.LogError("UICall is error:" + method + ex.Message);
     }
     return null;
 }
예제 #30
0
 //{"type":"auth_response","player":{"_username":"******","_xp":0,"_credits":500,"_level":1}}
 public Player(JsonData jo)
 {
     m_user = (string)jo["_username"];
     m_xp = (int)jo["_xp"];
     m_credits = (int)jo["_credits"];
     m_level = (int)jo["_level"];
 }
예제 #31
0
 public JsonAnalysis(string message)
 {
     jd = JsonMapper.ToObject(message);
 }
예제 #32
0
 public static AcquireAction FromDict(JsonData data)
 {
     return(new AcquireAction()
            .WithAction(data.Keys.Contains("action") && data["action"] != null ? data["action"].ToString() : null)
            .WithRequest(data.Keys.Contains("request") && data["request"] != null ? data["request"].ToString() : null));
 }
예제 #33
0
    IEnumerator TakeLeaderBoardData()
    {
        OverallScrollBar.SetActive(true);
        GradeScrollBar.SetActive(false);
        SchoolScrollBar.SetActive(false);
        if (PrenetOject.childCount == 0)
        {
            string Hitting_Url = MainUrl + LeaderBoardApi + "?id_user="******"UID") + "&org_id=" + PlayerPrefs.GetInt("OID");

            WWW Leaderborad_url = new WWW(Hitting_Url);
            yield return(Leaderborad_url);

            if (Leaderborad_url.text != null)
            {
                Debug.Log(Leaderborad_url.text);
                JsonData leader_res = JsonMapper.ToObject(Leaderborad_url.text);
                for (int a = 0; a < leader_res.Count; a++)
                {
                    GameObject gb = Instantiate(Dataprefeb, PrenetOject, false);
                    if (int.Parse(leader_res[a]["Rank"].ToString()) == 1)
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).GetComponent <Image>().sprite = FirstRank;
                    }
                    else if (int.Parse(leader_res[a]["Rank"].ToString()) == 2)
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).GetComponent <Image>().sprite = SecondRank;
                    }
                    else if (int.Parse(leader_res[a]["Rank"].ToString()) == 3)
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).GetComponent <Image>().sprite = ThirdRank;
                    }
                    else if (int.Parse(leader_res[a]["Rank"].ToString()) == 0)
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject.GetComponent <Text>().text = leader_res[a]["Rank"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(0).gameObject.SetActive(false);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.SetActive(true);
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject.GetComponent <Text>().text = leader_res[a]["Rank"].ToString();
                    }
                    if (PlayerPrefs.GetInt("UID") == int.Parse(leader_res[a]["id_user"].ToString()))
                    {
                        gb.transform.GetChild(0).gameObject.transform.GetChild(1).gameObject.transform.GetChild(0).gameObject.GetComponent <Text>().color = MydataColor;
                        gb.transform.GetChild(2).gameObject.GetComponent <Text>().color    = MydataColor;
                        gb.transform.GetChild(3).gameObject.GetComponent <Text>().color    = MydataColor;
                        gb.transform.GetChild(4).gameObject.GetComponent <Text>().color    = MydataColor;
                        gb.transform.GetChild(5).gameObject.GetComponent <Text>().color    = MydataColor;
                        gb.transform.GetChild(6).gameObject.GetComponent <Image>().enabled = false;
                        gb.transform.GetChild(6).gameObject.transform.GetChild(0).GetComponent <Text>().color = MydataColor;
                        gb.GetComponent <BarHeighter>().heighlitedimage = RowHighlighter;
                        gb.GetComponent <BarHeighter>().normalimage     = RowHighlighter;
                        gb.GetComponent <Image>().sprite = RowHighlighter;
                    }
                    gb.SetActive(true);
                    if (leader_res[a]["Name"] != null)
                    {
                        gb.transform.GetChild(2).gameObject.GetComponent <Text>().text = leader_res[a]["Name"].ToString();
                    }

                    if (leader_res[a]["Level"] != null)
                    {
                        gb.transform.GetChild(4).gameObject.GetComponent <Text>().text = leader_res[a]["Level"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(4).gameObject.GetComponent <Text>().text = "0";
                    }
                    if (leader_res[a]["Grade"] != null)
                    {
                        gb.transform.GetChild(5).gameObject.GetComponent <Text>().text = leader_res[a]["Grade"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(5).gameObject.GetComponent <Text>().text = "0";
                    }
                    if (leader_res[a]["SchoolName"] != null)
                    {
                        gb.transform.GetChild(3).gameObject.GetComponent <Text>().text = leader_res[a]["SchoolName"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(3).gameObject.GetComponent <Text>().text = "----";
                    }

                    if (leader_res[a]["Score"] != null)
                    {
                        gb.transform.GetChild(6).gameObject.transform.GetChild(0).GetComponent <Text>().text = leader_res[a]["Score"].ToString();
                    }
                    else
                    {
                        gb.transform.GetChild(6).gameObject.transform.GetChild(0).GetComponent <Text>().text = "0";
                    }
                    UserlistCreated.Add(gb);
                }
            }
        }
    }
 public static OpenMessageResult FromDict(JsonData data)
 {
     return(new OpenMessageResult {
         item = data.Keys.Contains("item") && data["item"] != null?Gs2.Gs2Inbox.Model.Message.FromDict(data["item"]) : null,
     });
 }
예제 #35
0
        private static string _GenJson(CSStruct code, List <IRow> rows, bool isTs)
        {
            _CheckHandle();
            var filedCount = code.fileds.Count;
            var totalData  = new JsonData();
            var isAdded    = false;

            foreach (var row in rows)
            {
                if (row == null)
                {
                    continue;
                }
                var jsonData = new JsonData();
                var isId     = true;
                var id       = 0;
                var isGen    = false;
                foreach (var filed in code.fileds)
                {
                    if (isId)
                    {
                        isId = false;
                        // 检查是否是ID
                        if (filed.name != "id")
                        {
                            LTDebug.LogError("excel配置表首行必须为id");
                            break;
                        }
                        // 检查是否是ID
                        if (filed.mtype != "int")
                        {
                            LTDebug.LogError("id配表类型必须为int");
                            break;
                        }
                        // 检查内容是否为空
                        var idCell = row.GetCell(filed.index);
                        if (idCell == null)
                        {
                            break;
                        }
                        if (idCell.CellType != CellType.Numeric)
                        {
                            break;
                        }
                        id    = Mathf.CeilToInt((float)row.GetCell(filed.index).NumericCellValue);
                        isGen = true;
                    }
                    if (filed.mtype == "" || filed.mtype == "skip")
                    {
                        continue;
                    }
                    var cell = row.GetCell(filed.index);
                    BaseExcelFiledExporter exporter = null;
                    if (_handleActions.TryGetValue(filed.mtype, out exporter))
                    {
                        exporter.DoExport(jsonData, filed, cell);
                    }
                    else
                    {
                        LTDebug.LogError("未处理的配表类型:{0}", filed.mtype);
                    }
                }
                if (isGen)
                {
                    if (isTs)
                    {
                        (totalData as IDictionary)[id.ToString()] = jsonData;
                    }
                    else
                    {
                        totalData.Add(jsonData);
                    }
                    isAdded = true;
                }
            }
            if (!isAdded)
            {
                return(string.Empty);
            }
            if (isTs)
            {
                return(totalData.ToJson());
            }
            else
            {
                var finalData = new JsonData();
                finalData["dataList"] = totalData;
                return(finalData.ToJson());
            }
        }
예제 #36
0
    public void LoadLocalization()
    {
        string jsonstring = File.ReadAllText(Application.dataPath + "/StreamingAssets" + "/Localization.json");

        LocalizationData = JsonMapper.ToObject(jsonstring);
    }
 public static GetCurrentStaminaMasterResult FromDict(JsonData data)
 {
     return(new GetCurrentStaminaMasterResult {
         item = data.Keys.Contains("item") && data["item"] != null?Gs2.Gs2Stamina.Model.CurrentStaminaMaster.FromDict(data["item"]) : null,
     });
 }
예제 #38
0
 public static LogSetting FromDict(JsonData data)
 {
     return(new LogSetting()
            .WithLoggingNamespaceId(data.Keys.Contains("loggingNamespaceId") && data["loggingNamespaceId"] != null ? data["loggingNamespaceId"].ToString() : null));
 }
예제 #39
0
    List <TaskItem> InitTaskItem(JsonData jd)
    {
        List <TaskItem> taskitem = new List <TaskItem> ();

        for (int i = 0; i < jd.Count; i++)
        {
            TaskItem ti = new TaskItem();
            ti._Id = int.Parse((string)jd[i]["_id"]);
            int id;
            if (jd[i]["_task"] == null)
            {
                id = 0;
            }
            else
            {
                id = int.Parse((string)jd[i]["_task"]);
            }
            Task t = null;
            if (taskList.TryGetValue(id, out t))
            {
                ti._Task = MakeNewTask(t);
            }
            switch ((string)jd[i]["_taskProgress"])
            {
            case "Accept":
                ti._TaskProgress = TaskProgress.Accept;
                break;

            case "Complete":
                ti._TaskProgress = TaskProgress.Complete;
                break;

            case "NoStart":
                ti._TaskProgress = TaskProgress.NoStart;
                break;

            case "Reward":
                ti._TaskProgress = TaskProgress.Reward;
                break;
            }
            switch ((string)jd[i]["_taskType"])
            {
            case "Main":
                ti._TaskType = TaskType.Main;
                break;

            case "Reward":
                ti._TaskType = TaskType.Reward;
                break;

            case "Daily":
                ti._TaskType = TaskType.Daily;
                break;
            }
            ti._IdTranscript = int.Parse((string)jd[i]["_idTranscript"]);
            ti._OwnName      = (string)jd[i]["_ownName"];
            if (id == 0)
            {
                ti._Name     = (string)jd[i]["_name"];
                ti._Des      = (string)jd[i]["_des"];
                ti._Coin     = int.Parse((string)jd[i]["_coin"]);
                ti._Diamond  = int.Parse((string)jd[i]["_diamond"]);
                ti._Mine     = int.Parse((string)jd[i]["_mine"]);
                ti._Ruby     = int.Parse((string)jd[i]["_ruby"]);
                ti._Treasure = int.Parse((string)jd[i]["_treasure"]);
                ti._Power    = int.Parse((string)jd[i]["_power"]);
                ti._Feats    = int.Parse((string)jd[i]["_feats"]);
            }
            taskitem.Add(ti);
        }
        return(taskitem);
    }
예제 #40
0
        private void OnReceive(IWebSocketConnection context, string msg)
        {
            Debug.WriteLine($"OnReceive {context.ConnectionInfo.Id}: {msg}");

            if (!msg.Contains("command"))
            {
                return;
            }

            if (UserList.ContainsKey(context.ConnectionInfo.Id))
            {
                JsonData msgJson = JsonMapper.ToObject(msg);
                string   command = msgJson["command"].ToString();

                switch (command)
                {
                case offer:
                {
                    if (UserList.Count <= ClientLimit && !Streams.ContainsKey(context.ConnectionInfo.Id))
                    {
                        var session = Streams[context.ConnectionInfo.Id] = new WebRtcSession();
                        {
                            using (var go = new ManualResetEvent(false))
                            {
                                var t = Task.Factory.StartNew(() =>
                                    {
                                        WebRtcNative.InitializeSSL();

                                        using (session.WebRtc)
                                        {
                                            session.WebRtc.AddServerConfig("stun:stun.l.google.com:19302", string.Empty, string.Empty);
                                            session.WebRtc.AddServerConfig("stun:stun.anyfirewall.com:3478", string.Empty, string.Empty);
                                            session.WebRtc.AddServerConfig("stun:stun.stunprotocol.org:3478", string.Empty, string.Empty);
                                            session.WebRtc.OnSuccessOffer += WebRtc_OnSuccessOffer;
                                            //session.WebRtc.AddServerConfig("turn:192.168.0.100:3478", "test", "test");

                                            //session.WebRtc.SetAudio(MainForm.audio);

                                            //if (!Form.checkBoxVirtualCam.Checked)
                                            //{
                                            //    if (!string.IsNullOrEmpty(Form.videoDevice))
                                            //    {
                                            //        var vok = session.WebRtc.OpenVideoCaptureDevice(Form.videoDevice);
                                            //        Trace.WriteLine($"OpenVideoCaptureDevice: {vok}, {Form.videoDevice}");
                                            //        if (!vok)
                                            //        {
                                            //            return;
                                            //        }
                                            //    }
                                            //}
                                            //else
                                            //{
                                            //    session.WebRtc.SetVideoCapturer(MainForm.screenWidth,
                                            //                                    MainForm.screenHeight,
                                            //                                    MainForm.captureFps);
                                            //}

                                            var ok = session.WebRtc.InitializePeerConnection();
                                            if (ok)
                                            {
                                                go.Set();

                                                // javascript side makes the offer in this demo
                                                session.WebRtc.CreateDataChannel("msgDataChannel");
                                                session.WebRtc.CreateOffer();

                                                while (!session.Cancel.Token.IsCancellationRequested &&
                                                       session.WebRtc.ProcessMessages(1000))
                                                {
                                                    Debug.Write(".");
                                                }
                                                session.WebRtc.ProcessMessages(1000);
                                            }
                                            else
                                            {
                                                Trace.WriteLine("InitializePeerConnection failed");
                                                context.Close();
                                            }
                                        }
                                    }, session.Cancel.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default);

                                if (go.WaitOne(9999))
                                {
                                    session.WebRtc.OnIceCandidate += delegate(string sdp_mid, int sdp_mline_index, string sdp)
                                    {
                                        if (context.IsAvailable)
                                        {
                                            JsonData j = new JsonData();
                                            j["command"]         = "OnIceCandidate";
                                            j["sdp_mid"]         = sdp_mid;
                                            j["sdp_mline_index"] = sdp_mline_index;
                                            j["sdp"]             = sdp;
                                            context.Send(j.ToJson());
                                        }
                                    };

                                    session.WebRtc.OnSuccessAnswer += delegate(string sdp)
                                    {
                                        if (context.IsAvailable)
                                        {
                                            JsonData j = new JsonData();
                                            j["command"] = "OnSuccessAnswer";
                                            j["sdp"]     = sdp;
                                            context.Send(j.ToJson());
                                        }
                                    };

                                    session.WebRtc.OnFailure += delegate(string error)
                                    {
                                        Trace.WriteLine($"OnFailure: {error}");
                                    };

                                    session.WebRtc.OnError += delegate(string error)
                                    {
                                        Trace.WriteLine($"OnError: {error}");
                                    };

                                    session.WebRtc.OnDataMessage += delegate(string dmsg)
                                    {
                                        Trace.WriteLine($"OnDataMessage: {dmsg}");
                                    };

                                    session.WebRtc.OnDataBinaryMessage += delegate(byte [] dmsg)
                                    {
                                        Trace.WriteLine($"OnDataBinaryMessage: {dmsg.Length}");
                                    };

                                    Form.ResetRemote();
                                    session.WebRtc.OnRenderRemote += delegate(IntPtr BGR24, uint w, uint h)
                                    {
                                        OnRenderRemote(BGR24, w, h);
                                    };

                                    Form.ResetLocal();
                                    session.WebRtc.OnRenderLocal += delegate(IntPtr BGR24, uint w, uint h)
                                    {
                                        OnRenderLocal(BGR24, w, h);
                                    };

                                    var d = msgJson["desc"];
                                    var s = d["sdp"].ToString();

                                    //session.WebRtc.OnOfferRequest(s);
                                }
                            }
                        }
                    }
                }
                break;

                case onicecandidate:
                {
                    var c = msgJson["candidate"];

                    var sdpMLineIndex = (int)c["sdpMLineIndex"];
                    var sdpMid        = c["sdpMid"].ToString();
                    var candidate     = c["candidate"].ToString();

                    var session = Streams[context.ConnectionInfo.Id];
                    {
                        session.WebRtc.AddIceCandidate(sdpMid, sdpMLineIndex, candidate);
                    }
                }
                break;
                }
            }
        }
예제 #41
0
 public static CreateNamespaceResult FromDict(JsonData data)
 {
     return(new CreateNamespaceResult {
         item = data.Keys.Contains("item") && data["item"] != null?Gs2.Gs2Gateway.Model.Namespace.FromDict(data["item"]) : null,
     });
 }
예제 #42
0
 public static CreateKeyResult FromDict(JsonData data)
 {
     return(new CreateKeyResult {
         item = data.Keys.Contains("item") && data["item"] != null?Gs2.Gs2Key.Model.Key.FromDict(data["item"]) : null,
     });
 }
예제 #43
0
 /// <summary>
 /// Sets the base json info no matter how the model was constructed
 /// </summary>
 /// <param name="reader">The reader to pull the model json from</param>
 private void InitializePaginators(TextReader reader)
 {
     this.PaginatorsRoot = JsonMapper.ToObject(reader);
 }
예제 #44
0
 public static GetStackStatusRequest FromDict(JsonData data)
 {
     return(new GetStackStatusRequest {
         stackName = data.Keys.Contains("stackName") && data["stackName"] != null ? data["stackName"].ToString(): null,
     });
 }
예제 #45
0
        private async void CheckUpdateButton_Click(object sender, RoutedEventArgs e)
        {
            CheckUpdateButton.IsEnabled = false;
            CheckUpdateButton.Content   = "检查中...";
            var client  = new RestClient("https://api.misakal.xyz");
            var request = new RestRequest("/Software_Update/Vrc_Convert/getUpdataInfo.php");
            // var request = new RestRequest("/Software_Update/Vrc_Convert/update.json");
            var response = client.Get(request);

            if (response.IsSuccessful)
            {
                try
                {
                    JsonData jsonData = JsonMapper.ToObject(response.Content);
                    if (version == (string)jsonData["laster"]["version"])
                    {
                        await this.ShowMessageAsync("你已经是最新版本了", "最新版本:" + (string)jsonData["laster"]["version"] + "\r\n本地版本:" + version);
                    }
                    else
                    {
                        MessageDialogResult result = await this.ShowMessageAsync("发现更新", "最新版本:" + (string)jsonData["laster"]["version"] + "\r\n本地版本" + version + "\r\n更新内容:\r\n" + (string)jsonData["laster"]["log"] + "\r\n是否更新?",
                                                                                 MessageDialogStyle.AffirmativeAndNegative,
                                                                                 new MetroDialogSettings()
                        {
                            AffirmativeButtonText = "取消",
                            NegativeButtonText    = "更新"
                        });

                        if (result == MessageDialogResult.Negative)
                        {
                            var progressControl = await this.ShowProgressAsync("正在更新", "下载新版本中...");

                            new Thread(a =>
                            {
                                try
                                {
                                    string tempFilePath = "Vrc_Convert_New.zip";
                                    Stream writer       = new FileStream(tempFilePath, FileMode.Create);

                                    ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                                    HttpWebRequest downloadRequest       = (HttpWebRequest)WebRequest.Create((string)jsonData["laster"]["download"]);
                                    HttpWebResponse downloadResponse     = (HttpWebResponse)downloadRequest.GetResponse();
                                    long totalBytes = downloadResponse.ContentLength;

                                    Stream downloadStream    = downloadResponse.GetResponseStream();
                                    long totalDownloadedByte = 0;
                                    byte[] downloadByte      = new byte[1024];
                                    int osize = downloadStream.Read(downloadByte, 0, (int)downloadByte.Length);
                                    while (osize > 0)
                                    {
                                        totalDownloadedByte = osize + totalDownloadedByte;
                                        writer.Write(downloadByte, 0, osize);
                                        osize = downloadStream.Read(downloadByte, 0, (int)downloadByte.Length);
                                        float downloadProgress = totalDownloadedByte / totalBytes;
                                        // Dispatcher.Invoke(new Action(delegate { progressControl.SetProgress(downloadProgress); progressControl.SetMessage("下载新版本中... (" + (downloadProgress * 100).ToString() + "%)"); }));
                                        progressControl.SetProgress(downloadProgress);
                                        progressControl.SetMessage("下载新版本中... (" + (downloadProgress * 100).ToString() + "%)");
                                    }
                                    downloadStream.Close();
                                    writer.Close();

                                    progressControl.SetMessage("正在释放文件...");
                                    if (Directory.Exists(Environment.CurrentDirectory + "\\update_cache"))
                                    {
                                        Directory.Delete(Environment.CurrentDirectory + "\\update_cache", true);
                                    }
                                    ZipFile.ExtractToDirectory(tempFilePath, Environment.CurrentDirectory + "\\update_cache");
                                    progressControl.CloseAsync();
                                    Dispatcher.Invoke(new Action(
                                                          async delegate
                                    {
                                        result = await this.ShowMessageAsync("请手动安装更新", "更新已下载完成。请点击 \"确认\" 并将弹出文件夹内容覆盖程序目录。");
                                        if (result == MessageDialogResult.Affirmative)
                                        {
                                            Process.Start("explorer.exe", Environment.CurrentDirectory + "\\update_cache");
                                            Environment.Exit(0);
                                        }
                                    }));
                                }
                                catch (Exception downloadException)
                                {
                                    progressControl.CloseAsync();
                                    Dispatcher.Invoke(new Action(delegate { this.ShowMessageAsync("下载失败", "错误信息:\r\n" + downloadException.Message + "\r\n错误追踪:" + downloadException.StackTrace); }));
                                }
                            })
                            {
                                IsBackground = true
                            }.Start();
                        }
                    }
                }
                catch
                {
                    await this.ShowMessageAsync("无法解析更新信息", "服务器返回内容:\r\n" + response.Content);
                }
            }
            else
            {
                await this.ShowMessageAsync("无法连接到检查更新服务", "Http 状态代码:" + response.StatusCode.ToString() + "\r\n错误信息:" + response.ErrorMessage + "\r\n错误追踪:" + response.ErrorException);
            }

            CheckUpdateButton.IsEnabled = true;
            CheckUpdateButton.Content   = "检查更新";
        }
예제 #46
0
    IEnumerator SendLoginToGameServer()
    {
        WWWForm form = new WWWForm();

        form.AddField("id", GameManager.instance.userId);
        form.AddField("login_ts", "12/31/1999 11:59:59");
        form.AddField("client", "web");
        Debug.Log(homebaseLoginURL);
        Debug.Log(GameManager.instance.userId);

        WWW www = new WWW(homebaseLoginURL, form);

        yield return(www);

        Debug.Log(www.text);

        if (www.error == null)
        {
            //encode the result into a json object so it can be checked through
            string   homebaseReturnJson = www.text.ToString();
            JsonData homebaseJson       = JsonMapper.ToObject(homebaseReturnJson);

            if (homebaseJson[0].ToString() == "Success")
            {
                //handle the success- load in game data, and go to the game screen
                Debug.Log(homebaseJson[1].ToString());

                GameManager.instance.wood         = (int)homebaseJson[2]["wood"];
                GameManager.instance.metal        = (int)homebaseJson[2]["metal"];
                GameManager.instance.lastLogin_ts = homebaseJson[3]["web_login_ts"].ToString();

                GameManager.instance.homebase_lat = float.Parse(homebaseJson[3]["homebase_lat"].ToString());
                GameManager.instance.homebase_lon = float.Parse(homebaseJson[3]["homebase_lon"].ToString());

                GameManager.instance.fitbit_authorization_code = homebaseJson[2]["fitbit_authorization_code"].ToString();
                GameManager.instance.fitbit_access_token       = homebaseJson[2]["fitbit_access_token"].ToString();
                GameManager.instance.fitbit_refresh_token      = homebaseJson[2]["fitbit_refresh_token"].ToString();
                string expire_time = homebaseJson[2]["fitbit_expire_datetime"].ToString();
                if (expire_time != "" && expire_time != "0000-00-00 00:00:00")
                {
                    GameManager.instance.fitbit_token_expiration = System.DateTime.Parse(expire_time);
                }
                else
                {
                    Debug.Log("player has not sync'ed their fitbit account.");
                }

                GameManager.instance.dataIsInitialized = true;

                SceneManager.LoadScene("02a Homebase");
            }
            else if (homebaseJson[0].ToString() == "Failed")
            {
                //handle failure- give the user a reason and DO NOT continue to game screen.
                failedLoginText.text = homebaseJson[1].ToString();
                loginFailedPanel.SetActive(true);
            }
        }
        else
        {
            Debug.Log("WWW error " + www.error);
        }
    }
예제 #47
0
    private void cardListCheck()
    {
        JsonData    res = cardData.cardList;
        IDictionary dic = res as IDictionary;

        if (res == null)
        {
            return;
        }

        if (dic.Contains("err"))
        {
            wsData.debug = res.ToJson();
            return;
        }

        for (int i = 0, j = myCardContent.transform.childCount; i < j; i++)
        {
            Destroy(myCardContent.transform.GetChild(i).gameObject);
        }

        if (!dic.Contains("cardList") || res ["cardList"].Count <= 0)
        {
            return;
        }

        ObjectPool <Button> op = null;

        if (!tutorialData.isTutorial)
        {
            op = new ObjectPool <Button> (myCardObj, "card", myCardContent.transform, 1, 1);
        }
        else
        {
            op = new ObjectPool <Button> (myCardObj, "card", myCardTutorialList.transform, 1, 1);
        }

        foreach (JsonData card in res["cardList"])
        {
            IDictionary cardDic = card ["card"] as IDictionary;

            int better = 0;

            if (cardDic.Contains("better"))
            {
                better = int.Parse(card ["card"] ["better"].ToString());
            }

            string _id           = card ["card"] ["_id"].ToString();
            string cid           = card ["card"] ["cid"].ToString();
            string grade         = card ["stat"] ["g"].ToString();
            string cardShortName = card ["stat"] ["nk"].ToString();

            Button newObj = op.Pop();

            rc.setSprite(newObj.transform.Find("cardImg"), cid);
            newObj.transform.Find("cardNamePannel").Find("cardName").GetComponent <Text> ().text = cardShortName;
            newObj.transform.Find("grade").Find("Text").GetComponent <Text> ().text = grade;

            if (better > 0)
            {
                newObj.transform.Find("better").GetComponent <Text> ().text = "+" + card ["card"] ["better"].ToString();
            }

            newObj.transform.Find("requestBtn").GetComponent <Button> ().onClick.AddListener(() => {
                if (tutorialData.isTutorial)
                {
                    rootData.adventureTutorialObj.SetActive(false);
                }

                battleRequest(_id);
            });

            if (!tutorialData.isTutorial)
            {
                newObj.transform.SetParent(myCardContent.transform);
                newObj.GetComponent <RectTransform> ().localPosition = new Vector3(newObj.transform.position.x, newObj.transform.position.y, 0);
                newObj.GetComponent <RectTransform> ().localScale    = new Vector3(1, 1, 1);
            }
            else
            {
                newObj.transform.SetParent(myCardTutorialList.transform);
                RectTransform rect = newObj.GetComponent <RectTransform> ();
                rect.localPosition    = new Vector3(0, 0, 0);
                rect.localScale       = new Vector3(1, 1, 1);
                rect.anchoredPosition = new Vector2(0, 0);
                rect.anchorMin        = new Vector2(0, 0);
                rect.anchorMax        = new Vector2(1, 1);
                break;
            }
        }

        if (!tutorialData.isTutorial)
        {
            setCellSize(3, myCardContent);
            myCardContent.GetComponent <RectTransform> ().localPosition = new Vector3(myCardContent.transform.localPosition.x, -1000, myCardContent.transform.localPosition.z);
        }

        isMyCardList = true;
    }
예제 #48
0
 /// <summary>
 /// Sets the base json info no matter how the model was constructed
 /// </summary>
 /// <param name="reader">The reader to pull the model json from</param>
 private void InitializeServiceModel(TextReader reader)
 {
     this.DocumentRoot = JsonMapper.ToObject(reader);
     this._metadata    = this.DocumentRoot[MetadataKey];
 }
예제 #49
0
        /// <summary>
        /// Create a list of OperationPaginatorConfigOptions based on the data provided
        /// </summary>
        /// <param name="node"> The JsonData node provided in the paginator config </param>
        /// <param name="setUnsupported"> Should the operation's paginator config be valid if there is an
        /// issue finding a matching member </param>
        /// <param name="mode"> Whether this is input or output token or neither</param>
        /// <returns></returns>
        internal IList <OperationPaginatorConfigOption> CreatePaginatorConfigOptionList(JsonData node, bool setUnsupported = true,
                                                                                        char mode = 'n')
        {
            var checkRequest  = mode == 'i' || mode == 'n';
            var checkResponse = mode == 'o' || mode == 'n';
            IList <OperationPaginatorConfigOption> optionList = new List <OperationPaginatorConfigOption>();

            if (node == null)
            {
                if (setUnsupported)
                {
                    this.operation.UnsupportedPaginatorConfig = true;
                }
                return(optionList);
            }
            else if (node.IsArray)
            {
                for (var i = 0; i < node.Count; i++)
                {
                    var option = GetOperationPaginatorConfigOption(node[i], checkRequest, checkResponse);
                    if (option != null)
                    {
                        optionList.Add(option);
                    }
                    else if (setUnsupported)
                    {
                        this.operation.UnsupportedPaginatorConfig = true;
                    }
                }
            }
            else
            {
                var option = GetOperationPaginatorConfigOption(node, checkRequest, checkResponse);
                if (option != null)
                {
                    optionList.Add(option);
                }
                else if (setUnsupported)
                {
                    this.operation.UnsupportedPaginatorConfig = true;
                }
            }
            return(optionList);
        }
 public static GetNamespaceStatusResult FromDict(JsonData data)
 {
     return(new GetNamespaceStatusResult {
         status = data.Keys.Contains("status") && data["status"] != null ? data["status"].ToString() : null,
     });
 }
예제 #51
0
        //获取Token
        public string GetToken()
        {
            string     sUrl   = "https://kploauth.jd.com/oauth/token";
            SortedList sParam = new SortedList();

            sParam.Add("grant_type", "password");
            sParam.Add("app_key", "6613b4b86b94458ea94c8236bc78cb1b");
            sParam.Add("app_secret", "2bb84e4d2e544c92850fa6b11a424038");
            sParam.Add("state", "0");
            sParam.Add("username", "kepler_test");
            sParam.Add("password", "e10adc3949ba59abbe56e057f20f883e");
            StringBuilder sb = new StringBuilder();

            foreach (DictionaryEntry item in sParam)
            {
                sb.Append(item.Key).Append("=").Append(item.Value).Append("&");
            }
            //sb.Append("grant_type").Append("=").Append(sParam["grant_type"]).Append("&");
            //sb.Append("app_key").Append("=").Append(sParam["app_key"]).Append("&");
            //sb.Append("app_secret").Append("=").Append(sParam["app_secret"]).Append("&");
            //sb.Append("state").Append("=").Append(sParam["state"]).Append("&");
            //sb.Append("username").Append("=").Append(sParam["username"]).Append("&");
            //sb.Append("password").Append("=").Append(sParam["password"]);
            string   sMessage = PostByHttpRequest(sb.ToString().Substring(0, sb.Length - 1), sUrl);
            JsonData jdP      = JsonMapper.ToObject(sMessage);
            string   mCode    = Convert.ToString(jdP["code"]);

            if (mCode == "0")//成功
            {
                string mAccess_token  = Convert.ToString(jdP["access_token"]);
                string mExpires_in    = Convert.ToString(jdP["expires_in"]);
                string mRefresh_token = Convert.ToString(jdP["refresh_token"]);
                string mToken_type    = Convert.ToString(jdP["token_type"]);
                string mUid           = Convert.ToString(jdP["uid"]);
                string mUser_nick     = Convert.ToString(jdP["user_nick"]);
                string mTime          = Convert.ToString(jdP["time"]);
                return(mAccess_token);
            }
            else if (mCode == "1004")
            {
                sParam["grant_type"] = "refresh_token";
                sb = new StringBuilder();
                sb.Append("grant_type").Append("=").Append(sParam["grant_type"]).Append("&");
                sb.Append("app_key").Append("=").Append(sParam["app_key"]).Append("&");
                sb.Append("app_secret").Append("=").Append(sParam["app_secret"]).Append("&");
                sb.Append("state").Append("=").Append(sParam["state"]).Append("&");
                sb.Append("username").Append("=").Append(sParam["username"]).Append("&");
                sb.Append("password").Append("=").Append(sParam["password"]);
                sMessage = PostByHttpRequest(sb.ToString(), sUrl);
                jdP      = JsonMapper.ToObject(sMessage);
                mCode    = Convert.ToString(jdP["code"]);
                if (mCode == "0")//成功
                {
                    string mAccess_token  = Convert.ToString(jdP["access_token"]);
                    string mExpires_in    = Convert.ToString(jdP["expires_in"]);
                    string mRefresh_token = Convert.ToString(jdP["refresh_token"]);
                    string mToken_type    = Convert.ToString(jdP["token_type"]);
                    string mUid           = Convert.ToString(jdP["uid"]);
                    string mUser_nick     = Convert.ToString(jdP["user_nick"]);
                    string mTime          = Convert.ToString(jdP["time"]);
                    return(mAccess_token);
                }
                else
                {
                    //提示错误信息code
                }
            }
            else
            {
                //提示错误信息code
            }
            return(mCode);
        }
예제 #52
0
    private void botListCheck()
    {
        JsonData    res = botData.botList;
        IDictionary dic = res as IDictionary;

        if (res == null)
        {
            return;
        }

        if (dic.Contains("err"))
        {
            wsData.debug = res.ToJson();
            return;
        }

        for (int i = 0, j = botContent.transform.childCount; i < j; i++)
        {
            Destroy(botContent.transform.GetChild(i).gameObject);
        }

        if (!dic.Contains("botList") || res ["botList"].Count <= 0)
        {
            return;
        }

        IDictionary         dicList = res ["botList"] as IDictionary;
        ObjectPool <Button> op      = null;

        if (!tutorialData.isTutorial)
        {
            op = new ObjectPool <Button> (botCardObj, "card", botContent.transform, 1, 1);
        }
        else
        {
            op = new ObjectPool <Button> (botCardObj, "card", botTutorialList.transform, 1, 1);
        }

        foreach (ICollection a in dicList.Values)
        {
            JsonData card = (JsonData)a;

            string cid           = card ["cid"].ToString();
            string grade         = card ["stat"] ["g"].ToString();
            string cardShortName = card ["stat"] ["nk"].ToString();
            string cardName      = card ["stat"] ["n"] + "\n(" + card ["stat"] ["nk"] + ") G." + card ["stat"] ["g"];
            string stat          = "공격력  <color=#CA4C4CFF>" + card ["stat"] ["a"] + "</color>\n"
                                   + "방어력  <color=#CA4C4CFF>" + card ["stat"] ["b"] + "</color>\n"
                                   + "치명타 확률  <color=#CA4C4CFF>" + card ["stat"] ["c"] + "%</color>";
            string magicStr = "[궁극기]\n";

            foreach (JsonData magic in card["stat"]["magic"])
            {
                magicStr += "<color=#CA4C4CFF>* " + magic.ToString() + "</color>\n";
            }

            Button newObj = op.Pop();

            rc.setSprite(newObj.transform.Find("cardImg"), cid);
            newObj.transform.Find("cardNamePannel").Find("cardName").GetComponent <Text> ().text = cardShortName;
            newObj.transform.Find("grade").Find("Text").GetComponent <Text> ().text = grade;
            newObj.transform.Find("requestBtn").GetComponent <Button> ().onClick.AddListener(() => {
                if (tutorialData.isTutorial)
                {
                    fingerAni.SetActive(false);
                    fingerAniMyCard.SetActive(true);
                }

                battleMyCard(cid);
                rootData.rootOverlayObj.SetActive(true);
            });

            if (!tutorialData.isTutorial)
            {
                newObj.transform.Find("descBtn").GetComponent <Button> ().onClick.AddListener(() => {
                    showDesc(cid, cardName, grade, stat, magicStr);
                });
            }

            GameObject hidePannel = newObj.transform.Find("hidePannel").gameObject as GameObject;
            GameObject hideLevel  = hidePannel.transform.Find("hideLevel").gameObject as GameObject;
            hidePannel.SetActive(false);
            hideLevel.SetActive(false);

            checkLevel(newObj, grade, hidePannel, hideLevel);

            if (!tutorialData.isTutorial)
            {
                newObj.GetComponent <RectTransform> ().localPosition = new Vector3(newObj.transform.position.x, newObj.transform.position.y, 0);
                newObj.GetComponent <RectTransform> ().localScale    = new Vector3(1, 1, 1);
            }
            else
            {
                RectTransform rect = newObj.GetComponent <RectTransform> ();
                rect.localPosition    = new Vector3(0, 0, 0);
                rect.localScale       = new Vector3(1, 1, 1);
                rect.anchoredPosition = new Vector2(0, 0);
                rect.anchorMin        = new Vector2(0, 0);
                rect.anchorMax        = new Vector2(1, 1);
                fingerAni.SetActive(true);
                break;
            }
        }

        if (!tutorialData.isTutorial)
        {
            setCellSize(3, botContent);
            float height = botContent.transform.GetComponent <RectTransform> ().rect.height + 1000;
            botContent.GetComponent <RectTransform> ().localPosition = new Vector3(botContent.transform.localPosition.x, -height, botContent.transform.localPosition.z);
        }

        isCardList = true;
    }
예제 #53
0
 public tijiaobiji(JsonData dta)
     : base(dta)
 {
     tdal = new JngsDal();
 }
예제 #54
0
 public static PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest FromDict(JsonData data)
 {
     return(new PrepareDownloadByUserIdAndDataObjectNameAndGenerationRequest {
         namespaceName = data.Keys.Contains("namespaceName") && data["namespaceName"] != null ? data["namespaceName"].ToString(): null,
         userId = data.Keys.Contains("userId") && data["userId"] != null ? data["userId"].ToString(): null,
         dataObjectName = data.Keys.Contains("dataObjectName") && data["dataObjectName"] != null ? data["dataObjectName"].ToString(): null,
         generation = data.Keys.Contains("generation") && data["generation"] != null ? data["generation"].ToString(): null,
         duplicationAvoider = data.Keys.Contains("duplicationAvoider") && data["duplicationAvoider"] != null ? data["duplicationAvoider"].ToString(): null,
     });
 }
예제 #55
0
 public override void ParseParams(JsonData parameters)
 {
 }
예제 #56
0
      public override object GetData()
      {
          int    i      = 0;
          string titile = "";

          try { titile = (string)optdatas["titile"]; }
          catch { titile = ""; }



          string content = "";

          try { content = (string)optdatas["content"]; }
          catch { content = ""; }

          string userid = "";

          try { userid = (string)optdatas["userid"]; }
          catch { userid = ""; }

          string baseimg = "";

          try { baseimg = (string)optdatas["baseimg"]; }
          catch { baseimg = ""; }
          JsonData js = new JsonData();

          try
          {
              Dictionary <string, string> dic = new Dictionary <string, string>();
              string filesname = "";
              if (baseimg != "")
              {
                  string ss = baseimg;
                  byte[] bt = Convert.FromBase64String(ss);
                  System.IO.MemoryStream stream = new System.IO.MemoryStream(bt);
                  Bitmap bitmap = new Bitmap(stream);
                  filesname = DateTime.Now.ToFileTime() + ".jpg";
                  bitmap.Save(@"C:\Web\笔记系统\fileimg\" + filesname + "", System.Drawing.Imaging.ImageFormat.Jpeg);
              }
              dic.Add("titile", titile);
              dic.Add("content", content);
              dic.Add("userid", userid);
              i = 1;
              int ii = BaseDal.InsertToTables("danci_t", dic);

              if (filesname != "")
              {
                  Dictionary <string, string> dic2 = new Dictionary <string, string>();
                  dic2.Add("danciid", ii.ToString());
                  dic2.Add("picurl", "../fileimg/" + filesname);
                  BaseDal.InsertToTables("upfiles", dic2);
              }
          }
          catch (Exception ex)
          {
              JngsDal.RecordError("tijiaobiji", ex.Message);
          }
          AddJsonProperty("id", ref js);
          js["id"] = i;
          return(js);
      }
예제 #57
0
        private static Response JsonDataToResponse(JsonData jd)
        {
            if (jd == null)
            {
                return(null);
            }

            Response res = new Response();

            try
            {
                if (jd["players"] != null && jd["players"].IsArray)
                {
                    res.players = new Stat[jd["players"].Count];
                    int pos = 0;
                    foreach (JsonData data in jd["players"])
                    {
                        int id;
                        try
                        {
                            id = data["id"].IsInt ? int.Parse(data["id"].ToString()) : 0;
                        }
                        catch
                        {
                            id = 0;
                        }

                        string name;
                        try
                        {
                            name = data["name"].IsString ? data["name"].ToString() : "";
                        }
                        catch
                        {
                            name = "";
                        }

                        int eff;
                        try
                        {
                            eff = data["eff"].IsInt ? int.Parse(data["eff"].ToString()) : 0;
                        }
                        catch
                        {
                            eff = 0;
                        }

                        int battles;
                        try
                        {
                            battles = data["battles"].IsInt ? int.Parse(data["battles"].ToString()) : 0;
                        }
                        catch
                        {
                            battles = 0;
                        }

                        int wins;
                        try
                        {
                            wins = data["wins"].IsInt ? int.Parse(data["wins"].ToString()) : 0;
                        }
                        catch
                        {
                            wins = 0;
                        }

                        res.players[pos++] = new Stat()
                        {
                            id      = id,
                            name    = name,
                            eff     = eff,
                            battles = battles,
                            wins    = wins,
                        };
                    }
                }
            }
            catch (Exception ex)
            {
                Log(2, "Parse error: players: " + ex);
            }

            try
            {
                if (jd["info"] == null)
                {
                    return(res);
                }

                res.info = new Info();
                if (jd["info"]["xvm"] != null)
                {
                    JsonData data = jd["info"]["xvm"];
                    res.info.xvm = new XVMInfo()
                    {
                        ver     = data["ver"].ToString(),
                        message = data["message"].ToString(),
                    };
                }
            }
            catch (Exception ex)
            {
                Log(2, "Parse error: info: " + ex);
            }

            return(res);
        }
예제 #58
0
 public override void ParseParams(JsonData parameters)
 {
     messageToPrint = parameters.ToString();
 }
예제 #59
0
    public GetRebateResult GetRebateList(string JSon, string version)
    {
        string   disid     = string.Empty;
        string   strsql    = string.Empty;
        string   RebateSum = string.Empty;
        string   CompId    = string.Empty;
        JsonData JInfo     = JsonMapper.ToObject(JSon);//JSon取值

        if (JInfo.Count > 0 && JInfo["ResellerID"].ToString() != "")
        {
            disid = JInfo["ResellerID"].ToString();
        }
        else
        {
            return(new GetRebateResult()
            {
                Result = "F", Description = "参数异常"
            });
        }
        //GetRebateResult getrebateresult = new GetRebateResult();
        //判断经销商对应的核心企业是否存在
        try
        {
            strsql  = "select CompID from BD_Distributor where id = " + disid + " ";
            strsql += " and isnull(AuditState,0) = 2 and ";
            strsql += " isnull(IsEnabled,1) = 1 and isnull(dr,0) = 0";
            CompId  = ClsSystem.gnvl(SqlAccess.ExecuteScalar(strsql, SqlHelper.LocalSqlServer), "");
            if (CompId == "")
            {
                return new GetRebateResult()
                       {
                           Result = "F", Description = "参数异常"
                       }
            }
            ;
            //取出此经销商所有可用的返利的总金额,此金额为返利总金额

            //strsql = "select sum(EnableAmount) as RebateSum from BD_Rebate where DisID = '" + disid + "' ";
            //strsql += " and getdate() between StartDate and dateadd(day,1,EndDate)";
            //strsql += " and isnull(RebateState,1) = 1";
            //strsql += " and isnull(dr,0) = 0 and compid = '" + CompId + "'";
            //RebateSum = ClsSystem.gnvl(SqlAccess.ExecuteScalar(strsql, SqlHelper.LocalSqlServer), "0");

            //版本6,及以上版本会在修改订单时查询可用返利,所以需要传入orderid,没有传空
            if (version.ToLower() == "ios" || version.ToLower() == "android" || float.Parse(version) < 6)
            {
                RebateSum = Common.GetRebate(0, Int32.Parse(disid));
            }
            else
            {
                RebateSum = Common.GetRebate(JInfo["OrderID"].ToString() == "" ? 0 : Int32.Parse(JInfo["OrderID"].ToString()), Int32.Parse(disid));
            }
            RebateSum = double.Parse(RebateSum).ToString("F2");
            //getrebateresult.RebateSum = RebateSum;
            //取出List<Rebate>中需要的数据,注意有效期的限制
            strsql  = "select ReceiptNo,RebateType,RebateAmount,UserdAmount,EnableAmount,StartDate,EndDate,Remark";
            strsql += " from BD_Rebate where DisID = " + disid + " ";
            strsql += " and getdate() between StartDate and dateadd(day,1,EndDate) and isnull(RebateState,1) = 1";
            strsql += " and isnull(dr,0) = 0 and compid = " + CompId + "";
            DataTable     dt_rebate   = SqlAccess.ExecuteSqlDataTable(strsql, SqlHelper.LocalSqlServer);
            List <Rebate> list_rebate = new List <Rebate>();
            //将每行数据循环赋值到List<Rebate>
            DateTime startDate, endDate;
            for (int i = 0; i < dt_rebate.Rows.Count; i++)
            {
                Rebate rebate = new Rebate();//Rebate实例
                rebate.RebateNo    = ClsSystem.gnvl(dt_rebate.Rows[i]["ReceiptNo"], "");
                rebate.RebateType  = ClsSystem.gnvl(dt_rebate.Rows[i]["RebateType"], "");
                rebate.RebateMoney = double.Parse(ClsSystem.gnvl(dt_rebate.Rows[i]["RebateAmount"], "0")).ToString("F2");
                rebate.UseredMoney = double.Parse(ClsSystem.gnvl(dt_rebate.Rows[i]["UserdAmount"], "0")).ToString("F2");
                rebate.EnableMoney = double.Parse(ClsSystem.gnvl(dt_rebate.Rows[i]["EnableAmount"], "0")).ToString("F2");
                //rebate.StartDate = ClsSystem.gnvl(dt_rebate.Rows[i]["StartDate"], "");
                if (ClsSystem.gnvl(dt_rebate.Rows[i]["StartDate"], "") != "")
                {
                    rebate.StartDate = DateTime.Parse(ClsSystem.gnvl(dt_rebate.Rows[i]["StartDate"], "")).ToString("yyyy/MM/dd");
                }
                else
                {
                    rebate.StartDate = "";
                }
                if (ClsSystem.gnvl(dt_rebate.Rows[i]["EndDate"], "") != "")
                {
                    rebate.EndDate = DateTime.Parse(ClsSystem.gnvl(dt_rebate.Rows[i]["EndDate"], "")).ToString("yyyy/MM/dd");
                }
                else
                {
                    rebate.EndDate = "";
                }
                //rebate.EndDate = ClsSystem.gnvl(dt_rebate.Rows[i]["EndDate"], "");
                rebate.Remark = ClsSystem.gnvl(dt_rebate.Rows[i]["Remark"], "");
                list_rebate.Add(rebate);
            }
            return(new GetRebateResult()
            {
                Result = "T",
                Description = "获取成功",
                RebateSum = RebateSum,
                RebateList = list_rebate
            });
        }
        catch (Exception ex)
        {
            Common.CatchInfo(ex.Message + ":" + ex.StackTrace, "GetRebate:" + JSon);
            return(new GetRebateResult()
            {
                Result = "F", Description = "参数异常"
            });
        }
    }
예제 #60
0
 public override void ParseParams(JsonData parameters)
 {
     _effectDefinitions = EffectDefinition.ParseDefinitions(parameters[D.EFFECTS], definition.definitionKey);
 }