/// <summary> /// Obtém o histórico de guild. /// </summary> public static void HistoryInfo() { var hData = new GuildHistory(); foreach (Guild gData in Guild.Guilds) { var varQuery = "SELECT date, player_name, description FROM guilds_history WHERE guild_id='" + gData.ID + "'"; var cmd = new MySqlCommand(varQuery, Common_DB.Connection); var reader = cmd.ExecuteReader(); while (reader.Read()) { hData.Date = (string)reader["date"]; hData.PlayerName = (string)reader["player_name"]; hData.Description = (string)reader["description"]; gData.History.Add(hData); hData.Date = string.Empty; hData.PlayerName = string.Empty; hData.Description = string.Empty; } reader.Close(); } }
public void Init(GuildHistory history) { m_DateTime = Utils.GetDateTimeByAnsiTime(history.HistoryTime); m_RecordIndex = 0; m_DateLabel.text = StrDictionary.GetClientDictionaryString("#{10456}", m_DateTime.Month, m_DateTime.Day); for (int i = 0; i < m_RecordLabel.Length; i++) { m_RecordLabel[i].gameObject.SetActive(false); } AddRecord(history); }
void OnEnable() { if (false == GameManager.gameManager.PlayerDataPool.IsHaveGuild()) { return; } Guild info = GameManager.gameManager.PlayerDataPool.GuildInfo; Utils.CleanGrid(m_GuildHistoryTable); // 记录上一次的item 当有同一天的日志时不创建item 而是在上一个item中加一条记录 GuildHistoryItemLogic itemBuffer = null; for (int i = info.GuildHistoryInfo.Count - 1; i >= 0; i--) { GuildHistory history = info.GuildHistoryInfo[i]; if (false == history.IsValid()) { break; } if (itemBuffer == null || false == itemBuffer.IsSameDate(history)) { // 第一个item或和上一个item不在同一天 创建 同时更新buffer string szItemName = i < 10 ? "0" + i.ToString() : i.ToString(); GameObject historyItem = Utils.BindObjToParent(m_GuildHistoryItem, m_GuildHistoryTable, szItemName); if (historyItem == null || historyItem.GetComponent <GuildHistoryItemLogic>() == null) { break; } historyItem.GetComponent <GuildHistoryItemLogic>().Init(history); itemBuffer = historyItem.GetComponent <GuildHistoryItemLogic>(); } else { // 在同一天 加记录 不创建新的 itemBuffer.AddRecord(history); } } if (m_GuildHistoryTable.GetComponent <UITable>() != null) { m_GuildHistoryTable.GetComponent <UITable>().Reposition(); } }
public void UpdateData(GC_GUILD_RET_INFO info) { //清空之前的数据 CleanUp(); //判断消息包数据合法性 if (null == info || info.GuildGuid == GlobeVar.INVALID_GUID) { return; } //填充数据 GuildGuid = info.GuildGuid; if (GuildGuid != GlobeVar.INVALID_GUID) { PreserveGuildGuid.Clear(); } GuildLevel = info.GuildLevel; GuildName = info.GuildName; GuildChiefGuid = info.GuildChiefGuid; GuildExp = info.GuildExp; GuildNotice = info.GuildNotice; GuildDeclaration = info.GuildDeclaration; NeedReserve = info.NeedReserve == 1; LastWeekContri = info.LastWeekContri; if (info.HasPscanacpttimes) { PSCanAcceptTimes = info.Pscanacpttimes; } for (int i = 0; i < info.memberGuidCount; ++i) { GuildMember member = new GuildMember(); //member.CleanUp(); member.Guid = info.GetMemberGuid(i); if (info.memberNameCount > i) { member.MemberName = info.GetMemberName(i); } if (info.memberVIPCount > i) { member.VIP = info.GetMemberVIP(i); } if (info.memberLevelCount > i) { member.Level = info.GetMemberLevel(i); } if (info.memberJobCount > i) { member.Job = info.GetMemberJob(i); } if (info.memberLastLogoutCount > i) { member.LastLogout = info.GetMemberLastLogout(i); } if (info.memberProfCount > i) { member.Profession = info.GetMemberProf(i); } if (info.memberStateCount > i) { member.State = info.GetMemberState(i); } if (info.memberContirbuteCount > i) { member.Contribute = info.GetMemberContirbute(i); } if (info.combatvalCount > i) { member.ComBatVal = info.GetCombatval(i); } if (member.IsValid()) { GuildMemberList.Add(member.Guid, member); } } for (int i = 0; i < info.ViceChiefRoutineCount && i < ViceChiefRoutine.Length; i++) { ViceChiefRoutine[i] = info.ViceChiefRoutineList[i] == 1; } for (int i = 0; i < info.ElderRoutineCount && i < ElderRoutine.Length; i++) { ElderRoutine[i] = info.ElderRoutineList[i] == 1; } for (int i = 0; i < info.GuildJobNameCount && i < GuildJobName.Length; i++) { GuildJobName[i] = info.GuildJobNameList[i]; } int nTextIndex = 0; for (int i = 0; i < info.GuildHistoryTypeCount; i++) { GuildHistory history = new GuildHistory(); if (info.GuildHistoryTypeCount > i) { history.HistoryType = info.GuildHistoryTypeList[i]; } if (info.GuildHistoryTimeCount > i) { history.HistoryTime = info.GuildHistoryTimeList[i]; } for (int j = 0; j < GuildHistory.GetTypeTextCount(history.HistoryType) && j < history.HistoryText.Length; j++) { history.HistoryText[j] = info.GuildHistoryTextList[nTextIndex]; nTextIndex += 1; } if (history.IsValid()) { GuildHistoryInfo.Add(history); } } for (int i = 0; i < info.SceneNpcIdCount; i++) { GuildHideAndSeekNpc npcInfo = new GuildHideAndSeekNpc(); if (info.SceneNpcIdCount > i) { npcInfo.SceneNpcId = info.SceneNpcIdList[i]; } if (info.SceneNpcFindCount > i) { npcInfo.IsFound = info.SceneNpcFindList[i] == 1; } if (npcInfo.IsValid()) { HideAndSeekNpcInfo.Add(npcInfo); } } if (info.HasHideAndSeekWeek) { m_HideAndSeekWeek = info.HideAndSeekWeek == 1; } //按照VIP等级排序 //SortMemberListByVIP(m_GuildMemberList); //按照等级排序 //SortMemberListByLevel(m_GuildMemberList); //按照在线状态进行排序 //SortMemberListByOnLine(m_GuildMemberList); //按照职位排序 //SortMemberListByJob(m_GuildMemberList); // 帮主永远第一位,玩家自己第二位,然后按照官职排,最后按照等级排列 SortByNewRule(); if (ChatInfoLogic.Instance() != null) { ChatInfoLogic.Instance().UpdateGuildChannel(); ChatInfoLogic.Instance().UpdateSpeakerList_Guild(); } }
public void AddRecord(GuildHistory history) { string szTypeDic = GuildHistory.GetTypeDic(history.HistoryType); if (string.IsNullOrEmpty(szTypeDic)) { return; } if (history.HistoryType <= (int)GuildHistory.GUILDHISTORY_TYPE.TYPE_INVALID || history.HistoryType >= (int)GuildHistory.GUILDHISTORY_TYPE.TYPE_MAX) { return; } if (m_RecordIndex < 0 || m_RecordIndex >= m_RecordLabel.Length) { return; } if (m_RecordLabel[m_RecordIndex] == null) { return; } string szHour = m_DateTime.Hour.ToString(); string szMinute = m_DateTime.Minute < 10 ? "0" + m_DateTime.Minute.ToString() : m_DateTime.Minute.ToString(); if (history.HistoryType == (int)GuildHistory.GUILDHISTORY_TYPE.TYPE_KICK) { m_RecordLabel[m_RecordIndex].text = StrDictionary.GetClientDictionaryString(szTypeDic, szHour, szMinute, history.HistoryText[0], history.HistoryText[1]); } if (history.HistoryType == (int)GuildHistory.GUILDHISTORY_TYPE.TYPE_LEAVE) { m_RecordLabel[m_RecordIndex].text = StrDictionary.GetClientDictionaryString(szTypeDic, szHour, szMinute, history.HistoryText[0]); } if (history.HistoryType == (int)GuildHistory.GUILDHISTORY_TYPE.TYPE_JOIN) { m_RecordLabel[m_RecordIndex].text = StrDictionary.GetClientDictionaryString(szTypeDic, szHour, szMinute, history.HistoryText[0]); } if (history.HistoryType == (int)GuildHistory.GUILDHISTORY_TYPE.TYPE_GUILDLEVELUP) { m_RecordLabel[m_RecordIndex].text = StrDictionary.GetClientDictionaryString(szTypeDic, szHour, szMinute); } m_RecordLabel[m_RecordIndex].gameObject.SetActive(true); // 计算背景动态高度 // 先算条目的总高度 int showCount = m_RecordIndex + 1; int backHeight = 0; for (int i = 0; i < showCount; i++) { backHeight += (int)m_RecordLabel[i].printedSize.y; } // 再算条目中间的间距 上下各有一个y间距 backHeight += (int)((2 * showCount) * m_RecordTabel.padding.y); // 再加条目两端的偏移 估算 写死 backHeight += 2 * 10; m_Background.height = backHeight; // 设置位置 左右偏移 (图的宽度-label的宽度)/2 居中 // 上下偏移 应该是20/2 但字体本身并不上下居中 写死为15 m_Background.gameObject.transform.localPosition = new Vector3(-(m_Background.width - m_RecordLabel[0].width) / 2, 15, 0); // 拖动判定框和背景图在一起 宽度和高度继承 因为背景图锚点在左上角 所以判定框的中心需要往右下偏移 m_SelfBox.size = new Vector3(m_Background.width, m_Background.height, 0); m_SelfBox.center = new Vector3(m_SelfBox.size.x / 2, -m_SelfBox.size.y / 2, 0); m_RecordTabel.Reposition(); m_RecordIndex += 1; }
public bool IsSameDate(GuildHistory history) { DateTime historyDate = Utils.GetDateTimeByAnsiTime(history.HistoryTime); return(m_DateTime.Year == historyDate.Year && m_DateTime.Month == historyDate.Month && m_DateTime.Day == historyDate.Day); }