public void AddRoleBaseInfo(UnityGMClient.CRoleBaseInfo role) { if (m_roleBaseInfoList == null) { m_roleBaseInfoList = new Hashtable(); } m_roleBaseInfoList.Add(role.getRoleIndex(), role); }
public void InitPlayerData(UnityGMClient.CPlayerData playerData) { m_roleBaseInfoList.Clear(); m_vipScore = playerData.VipScore; List <UnityGMClient.CRoleBaseInfo> list = playerData.RoleList; foreach (UnityGMClient.CRoleBaseInfo role in list) { UnityGMClient.CRoleBaseInfo roleInfo = new UnityGMClient.CRoleBaseInfo(); roleInfo = role; UInt32 key = roleInfo.getRoleIndex(); m_roleBaseInfoList.Add(key, roleInfo); } }
//动态显示radioButton public void showRadioButton(Hashtable list) { this.panelRole.Controls.Clear(); //控件上边缘与容器上边缘的距离 int top = 6; //记录循环,控件左上角相对于容器左上角的坐标 int i = 0; int n = 0; RadioButton[] radioButton = new RadioButton[list.Count]; foreach (DictionaryEntry roleData in list) { UnityGMClient.CRoleBaseInfo role = (UnityGMClient.CRoleBaseInfo)roleData.Value; if (n % 15 == 0 && n != 0) { i++; if (i % 5 == 0) { top = 6 * n; i = 0; } else { top = 6; } } radioButton[n] = new RadioButton(); radioButton[n].AutoSize = true; radioButton[n].Top = top; //控件左上角相对于容器左上角的坐标,以及每个控件之间的距离 radioButton[n].Location = new Point(i * 150 + 2, top); // MessageBox.Show(name[n].ToString()); radioButton[n].Text = role.getRoleName(); radioButton[n].Visible = true; radioButton[n].Name = role.getRoleIndex().ToString(); radioButton[n].CheckedChanged += new EventHandler(ckb_CheckedChanged); this.panelRole.Controls.Add(radioButton[n]); top = top + 21; n++; } if (radioButton.Length > 0) { radioButton[0].Checked = true; } }
public string getPlayerDataToLogString() { UnityGMClient.SAccountKey key = UnityGMClient.CClientCore.Singleton.getAccountKey(); string data = string.Format("[m_accountID={0},m_zoneID={1},roleCount={2},VipScore={3}]\r\n", key.m_accountID, key.m_zoneID, m_roleBaseInfoList.Count, m_vipScore); foreach (DictionaryEntry roleData in m_roleBaseInfoList) { UnityGMClient.CRoleBaseInfo role = (UnityGMClient.CRoleBaseInfo)roleData.Value; data += string.Format("[roleIndex={0}][name={1}][tpid={2}][level={3}]\r\n", role.getRoleIndex(), role.getRoleName(), role.getRoleTPID(), role.getLevel()); } return(data); }