// Кейбір жүктелген деректерді ескере отырып, компоненттің күйін жаңартады. public override void LoadFromData(JsonData data) { /* * Деректерде біз сақтайтын деректердің әр бөлігі болады деп болжай алмаймыз; * бағдарламашының мақалын есте сақтаңыз: * "сіз жасаған нәрсеңізге қатал болыңыз және қабылдағаныңызды кешір. * * Тиісінше, біз әрбір элементтің сақталған деректерде бар-жоғын тексереміз */ // Позицияны жаңарту if (data.ContainsKey(LOCAL_POSITION_KEY)) { transform.localPosition = DeserializeValue <Vector3>(data[LOCAL_POSITION_KEY]); } // Ротацияны жаңарту if (data.ContainsKey(LOCAL_ROTATION_KEY)) { transform.localRotation = DeserializeValue <Quaternion>(data[LOCAL_ROTATION_KEY]); } // Жаңарту шкаласы if (data.ContainsKey(LOCAL_SCALE_KEY)) { transform.localScale = DeserializeValue <Vector3>(data[LOCAL_SCALE_KEY]); } /*Бұл сценарийді пайдалану үшін ойын нысанына TransformSaver компонентін қосыңыз. * Ол сақталған ойындарға автоматты түрде қосылады және ойын жүктелген кезде оның күйі қалпына келтіріледі.*/ }
// Given some loaded data, updates the state of the component. public override void LoadFromData(JsonData data) { // We can't assume that the data will contain every piece of data // that we store; remember the programmer's adage, "be strict in // what you generate, and forgiving in what you accept". // Accordingly, we test to see if each item exists in the saved // data // Update position if (data.ContainsKey(LOCAL_POSITION_KEY)) { transform.localPosition = DeserializeValue <Vector3>(data[LOCAL_POSITION_KEY]); } // Update rotation if (data.ContainsKey(LOCAL_ROTATION_KEY)) { transform.localRotation = DeserializeValue <Quaternion>(data[LOCAL_ROTATION_KEY]); } // Update scale if (data.ContainsKey(LOCAL_SCALE_KEY)) { transform.localScale = DeserializeValue <Vector3>(data[LOCAL_SCALE_KEY]); } }
private IEnumerator LoginAsynk(UGS.Auth_PIN auth) { yield return(Context.StartCoroutine(auth.Process())); if (!auth.HasError) { Debug.Log(auth.Result); JsonData response = LitJsonSrc.JsonMapper.ToObject(auth.Result); if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 1) { StateController.Instance.Canvas.SetActive(true); StateController.Instance.PIN_text.text = "PIN Ok!"; StateController.Instance.ChangeState(Mark.GetSchedule); } if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 0 && response.ContainsKey("code")) { StateController.Instance.Canvas.SetActive(true); string label = null; foreach (char c in response["code"].AsInt().ToString()) { label += c + " "; } //StateController.Instance.PIN_text.text = response["code"].AsInt().ToString(); StateController.Instance.PIN_text.text = label; Context.StartCoroutine(RepeatRequest()); } } else { } }
private IEnumerator LoginAsynk(UGS.Auth_PIN auth) { yield return(StartCoroutine(auth.Process())); if (!auth.HasError) { Debug.Log(auth.Result); JsonData response = LitJsonSrc.JsonMapper.ToObject(auth.Result); if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 1) { splash.SetActive(false); pin_overlay.SetActive(true); PIN_text.text = "PIN Ok!"; SceneManager.LoadScene("DA_player"); } if (response.ContainsKey("errNo") && response["errNo"].AsInt() == 0 && response.ContainsKey("code")) { splash.SetActive(false); pin_overlay.SetActive(true); string label = null; foreach (char c in response["code"].AsInt().ToString()) { label += c + " "; } //StateController.Instance.PIN_text.text = response["code"].AsInt().ToString(); PIN_text.text = label; StartCoroutine(RepeatRequest()); } } else { LoadLogin(); } }
public List <WeiXinAgent> GetAgents() { List <WeiXinAgent> weiXinAgentList = new List <WeiXinAgent>(); string str = HttpHelper.SendGet("https://qyapi.weixin.qq.com/cgi-bin/agent/list?access_token=" + this.GetAccessToken()); JsonData jsonData1 = JsonMapper.ToObject(str); if (jsonData1.ContainsKey("errcode") && "0" != jsonData1["errcode"].ToString()) { RoadFlow.Platform.Log.Add("微信获取应用列表-失败", str, RoadFlow.Platform.Log.Types.微信企业号, "", "", (RoadFlow.Data.Model.Users)null); return(weiXinAgentList); } if (jsonData1.ContainsKey("agentlist") && jsonData1["agentlist"].IsArray) { foreach (JsonData jsonData2 in (IEnumerable)jsonData1["agentlist"]) { weiXinAgentList.Add(new WeiXinAgent() { agentid = jsonData2["agentid"].ToString().ToInt(), name = jsonData2["name"].ToString(), square_logo_url = jsonData2.ContainsKey("square_logo_url") ? jsonData2["square_logo_url"].ToString() : "", round_logo_url = jsonData2.ContainsKey("round_logo_url") ? jsonData2["round_logo_url"].ToString() : "" }); } } return(weiXinAgentList); }
public static Dictionary <String, String> GenerateConfig(JsonData json) { Dictionary <String, String> config = new Dictionary <String, String>(); if (json.ContainsKey("org") && json["org"].IsString) { config.Add("person-org", json["org"].ToString()); } if (json.ContainsKey("funct") && json["funct"].IsString) { config.Add("person-funct", json["funct"].ToString()); } if (json.ContainsKey("rang") && json["rang"].IsString) { config.Add("person-rang", json["rang"].ToString()); } if (json.ContainsKey("text") && json["text"].IsString) { config.Add("person-text", json["text"].ToString()); } if (json.ContainsKey("typ") && json["typ"].IsArray) { List <String> typs = new List <String>(); foreach (JsonData item in json["person"]["typ"]) { if (item.IsString) { typs.Add(item.ToString()); } } config.Add("person-typ", String.Join(",", typs)); } return(config); }
public virtual void Update(JsonData json) { this.Rssi = json.ContainsKey("Rssi") && (json["Rssi"].IsDouble || json["Rssi"].IsInt) && Double.TryParse(json["Rssi"].ToString(), out Double rssi) ? rssi : 0; this.Snr = json.ContainsKey("Snr") && (json["Snr"].IsDouble || json["Snr"].IsInt) && Double.TryParse(json["Snr"].ToString(), out Double snr) ? snr : 0; this.Lorarecievedtime = json.ContainsKey("Receivedtime") && json["Receivedtime"].IsString && DateTime.TryParse((String)json["Receivedtime"], DateTimeFormatInfo.InvariantInfo, DateTimeStyles.AssumeUniversal, out DateTime updatetime) ? updatetime.ToUniversalTime() : DateTime.UtcNow; this.Recievedtime = DateTime.UtcNow; this.Battery = Math.Round(json["BatteryLevel"].IsInt ? (Int32)json["BatteryLevel"] : (Double)json["BatteryLevel"], 2); this.Batterysimple = this.Battery < 3.44 ? 0 : this.Battery < 3.53 ? 1 : this.Battery < 3.6525 ? 2 : this.Battery < 3.8825 ? 3 : 4; this.Latitude = json["Gps"]["Latitude"].IsInt ? (Int32)json["Gps"]["Latitude"] : (Double)json["Gps"]["Latitude"]; this.Longitude = json["Gps"]["Longitude"].IsInt ? (Int32)json["Gps"]["Longitude"] : (Double)json["Gps"]["Longitude"]; this.Fix = (Boolean)json["Gps"]["Fix"]; this.Height = json["Gps"]["Height"].IsInt ? (Int32)json["Gps"]["Height"] : (Double)json["Gps"]["Height"]; this.Hdop = json["Gps"].ContainsKey("Hdop") && (json["Gps"]["Hdop"].IsDouble || json["Gps"]["Hdop"].IsInt) && Double.TryParse(json["Gps"]["Hdop"].ToString(), out Double hdop) ? hdop : 0; if (!this.Fix) { this.Latitude = this._lastLat; this.Longitude = this._lastLon; } else { this._lastLat = this.Latitude; this._lastLon = this.Longitude; this.Lastgpspostime = DateTime.UtcNow; } this.UTM = new UTMData(this.Latitude, this.Longitude); }
public List <WeiXinAgent> GetAgents() { List <WeiXinAgent> list = new List <WeiXinAgent>(); string text = HttpHelper.SendGet("https://qyapi.weixin.qq.com/cgi-bin/agent/list?access_token=" + GetAccessToken()); JsonData jsonData = JsonMapper.ToObject(text); if (jsonData.ContainsKey("errcode") && "0" != jsonData["errcode"].ToString()) { Log.Add("微信获取应用列表-失败", text, Log.Types.微信企业号); return(list); } if (jsonData.ContainsKey("agentlist") && jsonData["agentlist"].IsArray) { foreach (JsonData item in (IEnumerable)jsonData["agentlist"]) { WeiXinAgent weiXinAgent = new WeiXinAgent(); weiXinAgent.agentid = item["agentid"].ToString().ToInt(); weiXinAgent.name = item["name"].ToString(); weiXinAgent.square_logo_url = (item.ContainsKey("square_logo_url") ? item["square_logo_url"].ToString() : ""); weiXinAgent.round_logo_url = (item.ContainsKey("round_logo_url") ? item["round_logo_url"].ToString() : ""); list.Add(weiXinAgent); } return(list); } return(list); }
public static void FromJson(JsonData jsonNode, out string name, out string path, out int layer, out string tag, out Vector3 pos, out Quaternion rot, out Vector3 scale) { name = (string)jsonNode[SerializationConst.name]; path = (string)jsonNode[SerializationConst.path]; tag = string.Empty; layer = LayerUtility.DefaultLayer; if (jsonNode.ContainsKey(SerializationConst.layer)) { layer = (int)jsonNode[SerializationConst.layer]; } if (jsonNode.ContainsKey(SerializationConst.tag)) { tag = (string)jsonNode[SerializationConst.tag]; } if (string.IsNullOrEmpty(tag)) { tag = TagUtility.Untagged; } var transform = jsonNode[SerializationConst.transform]; LitJsonHelper.ParseVector(transform[0], out pos); LitJsonHelper.ParseQuaternion(transform[1], out rot); LitJsonHelper.ParseVector(transform[2], out scale); }
public static Boolean CheckJson(JsonData json) => json.ContainsKey("BatteryLevel") && (json["BatteryLevel"].IsDouble || json["BatteryLevel"].IsInt) && json.ContainsKey("Gps") && json["Gps"].IsObject && json["Gps"].ContainsKey("Latitude") && (json["Gps"]["Latitude"].IsDouble || json["Gps"]["Latitude"].IsInt) && json["Gps"].ContainsKey("Longitude") && (json["Gps"]["Longitude"].IsDouble || json["Gps"]["Longitude"].IsInt) && json["Gps"].ContainsKey("Fix") && json["Gps"]["Fix"].IsBoolean && json["Gps"].ContainsKey("Height") && (json["Gps"]["Height"].IsDouble || json["Gps"]["Height"].IsInt) && json.ContainsKey("Name") && json["Name"].IsString;
public static Author FromDict(JsonData data) { return(new Author { name = data.ContainsKey("name") ? data["name"].ToString() : null, url = data.ContainsKey("url") ? data["url"].ToString() : null, email = data.ContainsKey("email") ? data["email"].ToString() : null, }); }
private static PublicArtRecord FromJsonData(JsonData json) { return(new PublicArtRecord { type = json.ContainsKey("sitename") ? (string)json["type"] : null, siteName = json.ContainsKey("sitename") ? (string)json["sitename"] : null, latLong = json.ContainsKey("geom")? new Vector2((float)(double)json["geom"]["coordinates"][0], (float)(double)json["geom"]["coordinates"][1]) : new Vector2() }); }
public static Action[] GenEventProcessor(this GameUI gameUI, JsonData actionInfo) { var events = new List <ActionEvent>(); if (actionInfo.ContainsKey("hit")) { var hitList = actionInfo["hit"]; for (var i = 0; i < hitList.Count; i++) { events.Add(new ActionEvent { Enemy = SharedRefs.Mode == Constants.GameMode.Offline ? (int)hitList[i]["player"] == 1 : (bool)hitList[i]["isEnemy"], Pos = (int)hitList[i]["target"], Value = (int)hitList[i]["value"], Time = (int)hitList[i]["time"], Positive = false }); } } if (actionInfo.ContainsKey("passive")) { var passiveList = actionInfo["passive"]; for (var i = 0; i < passiveList.Count; i++) { if ((string)passiveList[i]["type"] == "heal") { events.Add(new ActionEvent { Enemy = SharedRefs.Mode == Constants.GameMode.Offline ? (int)passiveList[i]["player"] == 1 : (bool)passiveList[i]["isEnemy"], Pos = (int)passiveList[i]["source"], Value = (int)(double)passiveList[i]["value"], Time = (int)passiveList[i]["time"], Positive = true }); } } } events.Sort((x, y) => x.Time - y.Time); return(new Action[] { () => { gameUI.DiffAnim(events); }, () => { gameUI.AddEventsToLog(events); } }); }
public Item(JsonData jsonData) { id = jsonData["id"].ToString(); index = jsonData["index"].ToInt(); category = jsonData["category"].ToString(); string _itemType = jsonData["type"].ToString(); if (System.Enum.IsDefined(typeof(ItemType), _itemType)) { itemType = (ItemType)System.Enum.Parse(typeof(ItemType), _itemType); } if (jsonData.ContainsKey("productionAmount")) { productionAmountBase = jsonData["productionAmount"].ToDouble(); } if (jsonData.ContainsKey("price")) { basePrice = jsonData["price"].ToDouble(); } name = jsonData["name"].ToString(); image = jsonData["image"].ToString(); description = jsonData["description"].ToString(); productionTime = jsonData["productionTime"].ToInt(); string ingredientIDHeader = "ingredientID_"; string ingredientCountHeader = "ingredientCount_"; for (int i = 1; i < 4; i++) { string ingredientId = string.Empty; if (string.IsNullOrEmpty(jsonData[ingredientIDHeader + i].ToString())) { continue; } ingredientId = jsonData[ingredientIDHeader + i].ToString(); double ingredientCount = jsonData[ingredientCountHeader + i].ToDouble(); IngredientInfo info = new IngredientInfo(ingredientId, ingredientCount); ingredientList.Add(info); } }
public string GetUserAccountByCode(string code) { if (Config.OrganizeSecret.IsNullOrEmpty()) { List <RoadFlow.Data.Model.Dictionary> childs = new Dictionary().GetChilds("weixinagents"); if (childs.Count == 0) { return(""); } secret = (from p in childs orderby p.Sort select p).First().Note.Trim1(); } else { secret = Config.OrganizeSecret; } string text = "https://qyapi.weixin.qq.com/cgi-bin/user/getuserinfo?access_token=" + GetAccessToken() + "&code=" + code; string text2 = HttpHelper.SendGet(text); JsonData jsonData = JsonMapper.ToObject(text2); string result = jsonData.ContainsKey("UserId") ? jsonData["UserId"].ToString() : ""; Log.Add("调用了微信获取人员帐号", text, Log.Types.微信企业号, text2); return(result); }
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()); }
private void BackGroundRunner() { while (this.backgroundrunnerAlive) { List <Warning> ret = new List <Warning>(); foreach (Int32 item in Settings.Instance.Internal.WeatherCellIDs) { try { JsonData json = this.webrequests.GetJson("https://maps.dwd.de/geoserver/wfs?SERVICE=WFS&VERSION=2.0.0&REQUEST=GetFeature&typeName=dwd:Warnungen_Gemeinden&outputFormat=application/json&cql_filter=WARNCELLID=" + item); if (json.ContainsKey("features") && json["features"].IsArray && json["features"].Count > 0) { foreach (JsonData warning in json["features"]) { try { ret.Add(new Warning(warning)); } catch { } } } } catch { } } this.Warnungen = ret; for (Int32 i = 0; i < 1000; i++) { if (this.backgroundrunnerAlive) { Thread.Sleep(60); } } } }
/// <summary> /// 解析需要处理的消息 /// </summary> private void AnysiceMsg() { if (m_RecvMsg == null) { Debug.LogError("消息错误"); return; } try { m_RecvJsonData = JsonMapper.ToObject(m_RecvMsg); if (!m_RecvJsonData.ContainsKey("Type")) { Debug.LogWarning("发送数据格式有误!!!"); m_RecvMsg = string.Empty; return; } string type = (string)m_RecvJsonData["Type"]; switch (type) { case "one": AnysicsOne(); break; default: break; } } catch (Exception e) { Debug.LogError("数据解析格式错误" + e); m_RecvMsg = string.Empty; //throw; } }
public bool SetAgentInfo(WeiXinAgent agent) { string url = "https://qyapi.weixin.qq.com/cgi-bin/agent/set?access_token=" + this.GetAccessToken(); string json = new JsonData() { ["agentid"] = (JsonData)agent.agentid, ["report_location_flag"] = (JsonData)agent.report_location_flag, ["logo_mediaid"] = (JsonData)agent.logo_mediaid, ["name"] = (JsonData)agent.name, ["description"] = (JsonData)agent.description, ["redirect_domain"] = (JsonData)agent.redirect_domain, ["isreportuser"] = (JsonData)agent.isreportuser, ["isreportenter"] = (JsonData)agent.isreportenter, ["home_url"] = (JsonData)agent.home_url, ["chat_extension_url"] = (JsonData)agent.chat_extension_url }.ToJson(false); string data = json; string str = HttpHelper.SendPost(url, data); JsonData jsonData = JsonMapper.ToObject(str); if (jsonData.ContainsKey("errcode") && "0" != jsonData["errcode"].ToString()) { RoadFlow.Platform.Log.Add("微信设置应用-失败", str, RoadFlow.Platform.Log.Types.微信企业号, json, "", (RoadFlow.Data.Model.Users)null); return(false); } RoadFlow.Platform.Log.Add("微信设置应用-成功", str, RoadFlow.Platform.Log.Types.微信企业号, json, "", (RoadFlow.Data.Model.Users)null); return(true); }
/// <summary> 최초 로그인시 초기화 </summary> public void InitUserData(JsonData jsonData) { currentExp = jsonData["exp"].ToDouble(); OnLoad(); if (jsonData.ContainsKey("level")) { userLevel = jsonData["level"].ToInt(); } else { userLevel = 1; } userID = jsonData["id"].ToString(); googleID = jsonData["google"].ToString(); facebookID = jsonData["facebook"].ToString(); nickname = JsonParser.ToString(jsonData["nickname"]); signUpTime = jsonData["signUpTime"].ToString(); changeNickname = jsonData["changeNickname"].ToInt(); if (onChangedUserData != null) { onChangedUserData(); } isInitialized = true; }
public RankData(JsonData jsonData) { userID = jsonData["userID"].ToString(); nickname = jsonData["nickname"].ToString(); rank = jsonData["rank"].ToInt(); if (jsonData.ContainsKey("stage")) { stage = jsonData["stage"].ToInt(); } if (jsonData.ContainsKey("pvpScore")) { pvpScore = jsonData["pvpScore"].ToInt(); } }
string MailReceiveMessage(string result) { string text = string.Empty; if (string.IsNullOrEmpty(result)) { return(text); } JsonReader jReader = new JsonReader(result); JsonData jData = JsonMapper.ToObject(jReader); List <string> keys = GameDataManager.moneyBaseDataDic.Keys.ToList(); for (int i = 0; i < keys.Count; i++) { string key = keys[i]; if (jData.ContainsKey(key)) { text += "\n"; text += GameDataManager.moneyBaseDataDic[key].name + " : " + string.Format("{0:#,###}", Convert.ToInt32(JsonParser.ToString(jData[key]))); } } return(text); }
public bool AddDept(RoadFlow.Data.Model.Organize organize) { if (organize.IntID == 0) { organize = new RoadFlow.Platform.Organize().Get(organize.ID); } int num = 1; if (!organize.ParentID.IsEmptyGuid()) { RoadFlow.Data.Model.Organize organize1 = new RoadFlow.Platform.Organize().Get(organize.ParentID); if (organize1 != null) { num = organize1.IntID; } } string url = "https://qyapi.weixin.qq.com/cgi-bin/department/create?access_token=" + this.GetAccessToken(); string str = "{\"name\":\"" + this.replaceName(organize.Name) + "\",\"parentid\":" + num.ToString() + ",\"order\":" + organize.Sort.ToString() + ",\"id\":" + organize.IntID.ToString() + "}"; string json = HttpHelper.SendPost(url, str); JsonData jsonData = JsonMapper.ToObject(json); bool flag = jsonData.ContainsKey("errcode") && jsonData["errcode"].ToString().ToInt() == 0; RoadFlow.Platform.Log.Add("调用了微信添加部门-" + organize.Name + "-" + (flag ? "成功" : "失败"), "返回:" + json, RoadFlow.Platform.Log.Types.微信企业号, organize.Serialize(), str, (RoadFlow.Data.Model.Users)null); return(flag); }
public List <Tuple <int, string> > GetGroups() { string json = HttpHelper.SendGet("https://qyapi.weixin.qq.com/cgi-bin/tag/list?access_token=" + this.GetAccessToken()); JsonData jsonData1 = JsonMapper.ToObject(json); bool flag = jsonData1.ContainsKey("errcode") && jsonData1["errcode"].ToString().ToInt() == 0; RoadFlow.Platform.Log.Add("调用了微信所有标签-" + (flag ? "成功" : "失败"), "返回:" + json, RoadFlow.Platform.Log.Types.微信企业号, "", "", (RoadFlow.Data.Model.Users)null); List <Tuple <int, string> > tupleList = new List <Tuple <int, string> >(); if (flag) { JsonData jsonData2 = jsonData1["taglist"]; if (jsonData2.IsArray) { foreach (JsonData jsonData3 in (IEnumerable)jsonData2) { string str1 = jsonData3["tagid"].ToString(); string str2 = jsonData3["tagname"].ToString(); if (str1.IsInt() && !str2.IsNullOrEmpty()) { tupleList.Add(new Tuple <int, string>(str1.ToInt(), str2)); } } } } return(tupleList); }
void LoadHeroProficiency() { string fileName = Application.persistentDataPath + "/" + User.Instance.userID + "_HeroProficiency.dat"; if (!File.Exists(fileName)) { return; } string json = File.ReadAllText(fileName); //Debug.Log(json); //HeroProficiencySave saveData = JsonUtility.FromJson<HeroProficiencySave>(json); JsonData jsonData = JsonMapper.ToObject(json); JsonData heroListJsonData = jsonData["heroProficiencyTimeDic"]; //Debug.Log(heroListJsonData.Count + "개 = 불러옴"); //List<string> keys = new List<string>(saveData.heroProficiencyTimeDic.Keys); for (int i = 0; i < HeroManager.heroDataList.Count; i++) { HeroData heroData = HeroManager.heroDataList[i]; if (heroListJsonData.ContainsKey(heroData.id)) { float value = 0f; float.TryParse(heroListJsonData[heroData.id].ToStringJ(), out value); heroData.proficiencyTime = value; //Debug.Log(heroData.heroName + " / " + heroData.proficiencyTime); } } }
protected override JsonTableColumn GetColumnFromData(JsonData data, string key, string columnName) { var item = _schemaData.ActualProperties[key]; if (!data.ContainsKey(key)) { //add empty column from schema if (!item.IsArray) { return(JsonSchemaOnlyTableRow.ColumnFromSchemaData(columnName, item)); } } else { var column = base.GetColumnFromData(data, key, columnName); if (!item.IsArray && column != null) { //use DataType from schemaColumn for the actual column var schemaColumn = JsonSchemaOnlyTableRow.ColumnFromSchemaData(columnName, item); if (column.Content is string str && str == LlConstants.NullValue) //special case if colum is string, but type should be double and content should be null instead of NullValue { return(new JsonTableColumn(columnName, schemaColumn.DataType, schemaColumn.Content)); } else { return(new JsonTableColumn(columnName, schemaColumn.DataType, column.Content)); } }
void OnWebServerResult(Dictionary <string, object> resultDataDic) { if (resultDataDic.ContainsKey("dayDungeon")) { JsonReader json = new JsonReader(JsonMapper.ToJson(resultDataDic["dayDungeon"])); JsonData jsonData = JsonMapper.ToObject(json); int day = jsonData["day"].ToInt(); sunTopLevel = jsonData["sunTopLevel"].ToInt(); monTopLevel = jsonData["monTopLevel"].ToInt(); tueTopLevel = jsonData["tueTopLevel"].ToInt(); wedTopLevel = jsonData["wedTopLevel"].ToInt(); thuTopLevel = jsonData["thuTopLevel"].ToInt(); friTopLevel = jsonData["friTopLevel"].ToInt(); satTopLevel = jsonData["satTopLevel"].ToInt(); today = (Day)day; float reminingTime = 0; if (jsonData.ContainsKey("remainingTime")) { reminingTime = jsonData["remainingTime"].ToFloat(); } startTime = Time.unscaledTime + reminingTime; //Debug.Log("reminingTime : " + reminingTime.ToString()); } }
public bool RunTask(ICharacter character) { string tweettext = text; foreach (string t in tag) { tweettext += " #" + t; } string ret = SendBirdTool.MakeReplyBird(character.auth, tweettext, target); JsonData json = JsonMapper.ToObject(ret); if (json.ContainsKey("id_str")) { LikeTask like = new LikeTask(new ITask.HALDLE_INFO { type = ITask.HALDLE_TYPE.ALL }, json["id_str"].ToString()); TaskQueueTool.AddImportantTask(like); RetweetTask retweet = new RetweetTask(new ITask.HALDLE_INFO { type = ITask.HALDLE_TYPE.ALL_WITHOUT, without_id = new string[] { character.character_id } }, json["id_str"].ToString()); TaskQueueTool.AddImportantTask(retweet); life--; if (life > 0) { ReplyTweetTask reply = new ReplyTweetTask(new ITask.HALDLE_INFO { type = ITask.HALDLE_TYPE.RANDOM_MUL_WITHOUT, count = life - random.Next(0, life), without_id = new string[] { character.character_id } }, json["id_str"].ToString(), Bullet.GetBullet(text), tag, life - random.Next(0, life)); TaskQueueTool.AddImportantTask(reply); } return(true); } return(false); }
public bool AddGroupUser(RoadFlow.Data.Model.WorkGroup group) { string url = "https://qyapi.weixin.qq.com/cgi-bin/tag/addtagusers?access_token=" + this.GetAccessToken(); if (group.Members.IsNullOrEmpty()) { return(true); } List <RoadFlow.Data.Model.Users> allUsers = new RoadFlow.Platform.Organize().GetAllUsers(group.Members); List <string> stringList = new List <string>(); foreach (RoadFlow.Data.Model.Users users in allUsers) { stringList.Add(users.Account); } string userAccounts = Tools.GetSqlInString <string>(stringList.ToArray(), true).Replace("'", "\""); if (!this.DeleteGroupUser(group.IntID, userAccounts)) { return(false); } string str = "{\"tagid\":" + group.IntID.ToString() + ",\"userlist\":[" + userAccounts + "]}"; string json = HttpHelper.SendPost(url, str); JsonData jsonData = JsonMapper.ToObject(json); bool flag = jsonData.ContainsKey("errcode") && jsonData["errcode"].ToString().ToInt() == 0; RoadFlow.Platform.Log.Add("调用了微信更新标签成员-" + (flag ? "成功" : "失败"), "返回:" + json, RoadFlow.Platform.Log.Types.微信企业号, str, "", (RoadFlow.Data.Model.Users)null); return(flag); }
public bool SetAgentInfo(WeiXinAgent agent) { string url = "https://qyapi.weixin.qq.com/cgi-bin/agent/set?access_token=" + GetAccessToken(); JsonData jsonData = new JsonData(); jsonData["agentid"] = agent.agentid; jsonData["report_location_flag"] = agent.report_location_flag; jsonData["logo_mediaid"] = agent.logo_mediaid; jsonData["name"] = agent.name; jsonData["description"] = agent.description; jsonData["redirect_domain"] = agent.redirect_domain; jsonData["isreportuser"] = agent.isreportuser; jsonData["isreportenter"] = agent.isreportenter; jsonData["home_url"] = agent.home_url; jsonData["chat_extension_url"] = agent.chat_extension_url; string text = jsonData.ToJson(false); string text2 = HttpHelper.SendPost(url, text); JsonData jsonData2 = JsonMapper.ToObject(text2); if (jsonData2.ContainsKey("errcode") && "0" != jsonData2["errcode"].ToString()) { Log.Add("微信设置应用-失败", text2, Log.Types.微信企业号, text); return(false); } Log.Add("微信设置应用-成功", text2, Log.Types.微信企业号, text); return(true); }
public bool EditUser(RoadFlow.Data.Model.Users user) { if (user.Mobile.IsNullOrEmpty() && user.Email.IsNullOrEmpty() && user.WeiXin.IsNullOrEmpty()) { return(false); } if (this.GetUser(user.Account).IsNullOrEmpty()) { return(this.AddUser(user)); } string url = "https://qyapi.weixin.qq.com/cgi-bin/user/update?access_token=" + this.GetAccessToken(); List <RoadFlow.Data.Model.UsersRelation> allByUserId = new RoadFlow.Platform.UsersRelation().GetAllByUserID(user.ID); RoadFlow.Platform.Organize organize1 = new RoadFlow.Platform.Organize(); StringBuilder stringBuilder = new StringBuilder(); foreach (RoadFlow.Data.Model.UsersRelation usersRelation in allByUserId) { RoadFlow.Data.Model.Organize organize2 = organize1.Get(usersRelation.OrganizeID); if (organize2 != null) { stringBuilder.Append(organize2.IntID); stringBuilder.Append(","); } } string str = "{\"userid\":\"" + user.Account + "\",\"name\":\"" + this.replaceName(user.Name) + "\",\"department\":[" + stringBuilder.ToString().TrimEnd(',') + "],\"position\":\"\",\"mobile\":\"" + user.Mobile + "\"," + (user.Sex.HasValue ? "\"gender\":\"" + (user.Sex.Value + 1).ToString() + "\"," : "") + "\"email\":\"" + user.Email + "\",\"weixinid\":\"" + user.WeiXin + "\",\"enable\":" + (user.Status == 0 ? 1 : 0).ToString() + "}"; string json = HttpHelper.SendPost(url, str); JsonData jsonData = JsonMapper.ToObject(json); bool flag = jsonData.ContainsKey("errcode") && jsonData["errcode"].ToString().ToInt() == 0; RoadFlow.Platform.Log.Add("调用了微信修改人员-" + user.Name + "-" + (flag ? "成功" : "失败"), "返回:" + json, RoadFlow.Platform.Log.Types.微信企业号, user.Serialize(), str, (RoadFlow.Data.Model.Users)null); return(flag); }