//刷新批准申请 private void UpdateApplyGrid(UIGridItem item) { if (item == null || item.mScripts == null || item.oData == null) { return; } applyinfo = item.oData as GuildApplyInfo; UITexture portrait_texture = item.mScripts[0] as UITexture; UILabel name_label = item.mScripts[1] as UILabel; UILabel post_label = item.mScripts[2] as UILabel; UILabel level_label = item.mScripts[3] as UILabel; UILabel applytime_label = item.mScripts[4] as UILabel; UILabel state_time = item.mScripts[5] as UILabel; UISprite agree_btn = item.mScripts[6] as UISprite; UISprite reject_btn = item.mScripts[7] as UISprite; post_label.text = TextManager.GetUIString("UIOffical" + applyinfo.offical); name_label.text = applyinfo.playerName; level_label.text = applyinfo.level.ToString(); DateTime utcdt = DateTime.Parse(DateTime.UtcNow.ToString("1970-01-01 00:00:00")).AddSeconds(applyinfo.applyTime); //转成本地时间 DateTime localdt = utcdt.ToLocalTime(); string timeformat = localdt.ToString("yyyy-MM-dd HH:mm:ss"); applytime_label.text = timeformat; state_time.text = ""; UIEventListener.Get(agree_btn.gameObject).onClick = OnApplyClick; UIEventListener.Get(reject_btn.gameObject).onClick = OnApplyClick; }
public override void SetInfo(object data) { _info = (GuildApplyInfo)data; _txtName.text = _info.Name; _txtLevel.text = _info.Level.ToString(); _txtFightScore.text = _info.FightScore.ToString(); }
//申请数据转换 private GuildApplyInfo ChangeApplyData(Dictionary <string, object> data) { GuildApplyInfo apply = new GuildApplyInfo(); apply.id = GameConvert.IntConvert(data["dbid"]); apply.playerName = GameConvert.StringConvert(data["playerName"]); apply.offical = GameConvert.IntConvert(data["offical"]); apply.level = GameConvert.IntConvert(data["level"]); apply.applyTime = GameConvert.DoubleConvert(data["applyTime"]); return(apply); }
//玩家等级 private int CompareApplyLevel(GuildApplyInfo info1, GuildApplyInfo info2) { if (info1.level > info2.level) { return(-1); } else if (info1.level < info2.level) { return(1); } else { return(0); } }
//申请时间 private int CompareApplyTime(GuildApplyInfo info1, GuildApplyInfo info2) { if (info1.applyTime > info2.applyTime) { return(-1); } else if (info1.applyTime < info2.applyTime) { return(1); } else { return(0); } }
//公会申请信息 public void onGuildApplyList(List <object> list) { MyGuildInfo info = GuildMainMediator.mMyGuild; info.applyList.Clear(); for (int i = 0; i < list.Count; i++) { Dictionary <string, object> data = list[i] as Dictionary <string, object>; GuildApplyInfo apply = ChangeApplyData(data); info.applyList.Add(apply); } if (GUIManager.HasView("guildofficepanel")) { GuildOfficeMediator.guildOfficeMediator.SetApplyGridData(); } }
private void OnApplyClick(GameObject go) { UIGridItem item = go.transform.parent.GetComponent <UIGridItem>(); GuildApplyInfo data = item.oData as GuildApplyInfo; bool isPower = GuildMainMediator.guildmainMediator.IsPowerEnough("10"); if (!isPower) { GUIManager.SetPromptInfo(TextManager.GetSystemString("ui_system_guild_err11"), null); return; } switch (go.transform.name) { case "agree_btn": ServerCustom.instance.SendClientMethods(GuildProxy.OnClientAgreeJoin, data.id); break; case "reject_btn": ServerCustom.instance.SendClientMethods(GuildProxy.OnClientRejectApply, data.id); break; } }