GlobalUserInfo.js 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. systemtime = cc.Class({
  2. ctor :function () {
  3. this.wYear = 0;
  4. this.wMonth = 0;
  5. this.wDayOfWeek = 0;
  6. this.wDay = 0;
  7. this.wHour = 0;
  8. this.wMinute = 0;
  9. this.wSecond = 0;
  10. this.wMilliseconds = 0;
  11. },
  12. });
  13. //头像信息
  14. tagCustomFaceInfo = cc.Class({
  15. ctor :function () {
  16. this.dwDataSize = 0; //数据大小
  17. this.dwCustomFace = 0; //图片信息
  18. },
  19. });
  20. //用户信息
  21. tagGlobalUserData = cc.Class({
  22. ctor :function () {
  23. //基本资料
  24. this.dwUserID = 0; //用户 I D
  25. this.dwGameID = 0; //游戏 I D
  26. this.dwExperience = 0; //用户经验
  27. this.szAccounts = ""; //登录帐号
  28. this.szNickName = ""; //用户昵称
  29. this.szPassword = ""; //登录密码
  30. this.szDynamicPass = ""; //动态密码
  31. //用户成绩
  32. this.llUserScore = 0; //用户游戏币
  33. this.llUserInsure = 0; //用户银行
  34. this.llUserIngot = 0; //用户钻石
  35. this.dUserBeans = 0; //用户游戏豆
  36. //扩展资料
  37. this.cbGender = 0; //用户性別
  38. this.cbMoorMachine = 0; //锁定机器
  39. this.szUnderWrite = ""; //个性签名
  40. //社团资料
  41. this.dwGroupID = 0; //社团索引
  42. this.szGroupName = ""; //社团名字
  43. this.szClientIP = '';
  44. //会员资料
  45. this.cbMemberOrder = 0; //会员等级
  46. this.MemberOverDate = new systemtime(); //到期时间
  47. //头像信息
  48. this.wFaceID = 0; //头像索引
  49. this.dwCustomID = 0; //自定标识
  50. this.CustomFaceInfo = new tagCustomFaceInfo();//自定头像
  51. //配置信息
  52. this.cbInsureEnabled = 0; //银行使能
  53. //登录信息
  54. this.dwLogonTickCount = 0; //登录时间
  55. // 是否签到
  56. this.bTodayChecked = false; // 是否签到
  57. //this.szHeadImgURL = ""; //微信头像
  58. //基本资料
  59. this.len_szAccounts = window.LEN_ACCOUNTS*cc.TCHAR_SIZE; //登录帐号
  60. this.len_szNickName = window.LEN_NICKNAME*cc.TCHAR_SIZE; //用户昵称
  61. this.len_szPassword = window.LEN_MD5*cc.TCHAR_SIZE; //登录密码
  62. this.len_szDynamicPass = window.LEN_PASSWORD*cc.TCHAR_SIZE; //动态密码
  63. this.len_szUnderWrite = window.LEN_UNDER_WRITE*cc.TCHAR_SIZE; //个性签名
  64. this.len_szGroupName = window.LEN_GROUP_NAME*cc.TCHAR_SIZE; //社团名字
  65. this.len_szClientIP = window.LEN_IP*cc.TCHAR_SIZE;
  66. },
  67. });
  68. //银行信息
  69. tagUserInsureInfo = cc.Class({
  70. ctor:function() {
  71. this.wRevenueTake = 0; //税收比例
  72. this.wRevenueTransfer = 0; //税收比例
  73. this.wServerID = 0; //房间标识
  74. this.llUserScore = 0; //用户游戏币
  75. this.llUserInsure = 0; //银行游戏币
  76. this.lTransferPrerequisite = 0; //转账条件
  77. },
  78. });
  79. CGlobalUserInfo = cc.Class({
  80. ctor :function () {
  81. this.m_GlobalUserData = new tagGlobalUserData();
  82. this.m_UserInsureInfo = new tagUserInsureInfo();
  83. this.m_UserInfoMap = new Object();
  84. this.m_UserHeadMap = new Object();
  85. this.m_UserGameIDMap = new Object();
  86. this.m_NetImageMap = new Object();
  87. },
  88. SetUserInfo:function (dwUserID,NickName,GameID,Url,Gender) {
  89. if( this.m_UserInfoMap[dwUserID] == null || this.m_UserInfoMap[dwUserID] == 'Loading' ){
  90. this.m_UserInfoMap[dwUserID] = new Object();
  91. }
  92. this.m_UserGameIDMap[GameID] = dwUserID;
  93. this.m_UserInfoMap[dwUserID].NickName = NickName;
  94. this.m_UserInfoMap[dwUserID].GameID = GameID;
  95. this.m_UserInfoMap[dwUserID].HeadUrl = Url;
  96. this.m_UserInfoMap[dwUserID].Gender = Gender;
  97. },
  98. SetUserAddress: function(dwUserID, szAddr, bError) {
  99. if (this.m_UserInfoMap[dwUserID] == null || this.m_UserInfoMap[dwUserID] == 'Loading') {
  100. console.log(' SetUserAddress Error, ['+ dwUserID + '] is ' + typeof(this.m_UserInfoMap[dwUserID]));
  101. return;
  102. }
  103. this.m_UserInfoMap[dwUserID].Address = szAddr;
  104. this.m_UserInfoMap[dwUserID].cbAddrCode = 1;
  105. this.m_UserInfoMap[dwUserID].bAddrError = bError;
  106. },
  107. GetUserAddress: function(dwUserID) {
  108. if (!this.m_UserInfoMap[dwUserID]) {
  109. return {berror: true, code: 3, string:''};
  110. } else if (this.m_UserInfoMap[dwUserID] == 'Loading') {
  111. console.log(' GetUserAddress Error, ['+ dwUserID + '] is ' + typeof(this.m_UserInfoMap[dwUserID]));
  112. return {berror: true, code: 2, string:'玩家資訊加載未完成,請稍後再試!'};
  113. }
  114. if(this.m_UserInfoMap[dwUserID].cbAddrCode == 1) return {
  115. berror:this.m_UserInfoMap[dwUserID].bAddrError,
  116. code: this.m_UserInfoMap[dwUserID].cbAddrCode,
  117. string: this.m_UserInfoMap[dwUserID].Address
  118. };
  119. return {berror: true, code: 0, string: '加載中...'};
  120. },
  121. GetGlobalUserData :function(){
  122. return this.m_GlobalUserData;
  123. },
  124. GetUserInsureInfo :function(){
  125. return this.m_UserInsureInfo;
  126. },
  127. GetUserDefaultFace :function(){
  128. if(this.m_GlobalUserData.cbGender == 0)
  129. return "plaza_default_face_0.png";
  130. else if(this.m_GlobalUserData.cbGender == 1)
  131. return "plaza_default_face_1.png";
  132. },
  133. GetUserDefaultFaceByGender:function (gender){
  134. if(gender == 0)
  135. return "plaza_default_face_0.png";
  136. else if(gender == 1)
  137. return "plaza_default_face_1.png";
  138. },
  139. });
  140. g_GlobalUserInfo = new CGlobalUserInfo();