public UInfo(ref Uid uid, string uname, ref Uencip encip, int id_this_session) { m_uid = uid; m_uname = uname; m_encip = encip; m_id_this_session = id_this_session; }
// --------------------------------------------------- public static void Remove_Absent() { // idx による削除は後方から行う必要がある for (int idx = msab_attend.Count; --idx >= 0;) { if (msab_attend[idx] == false) { msa_uinfo.RemoveAt(idx); msab_attend.RemoveAt(idx); } } // 多窓チェック int idx_tmnt = msa_uinfo.Count; for (int idx = idx_tmnt; --idx >= 0;) { msa_uinfo[idx].mb_multi = false; } if (idx_tmnt <= 1) { return; } for (int src = 0; src < idx_tmnt - 1; src++) { if (msa_uinfo[src].mb_multi == true) { continue; } ref Uencip src_encip = ref msa_uinfo[src].m_encip; for (int cmp = src + 1; cmp < idx_tmnt; cmp++) { if (src_encip.IsEqualTo(ref msa_uinfo[cmp].m_encip) == true) { msa_uinfo[src].mb_multi = true; msa_uinfo[cmp].mb_multi = true; } } }
// --------------------------------------------------- // 戻り値: ban すべきユーザであった場合、true が返される public static void Attend(ref Uid uid, string uname, ref Uencip encip) { int idx_uid = -1; for (int idx = msa_uinfo.Count; --idx >= 0;) { if (msa_uinfo[idx].m_uid.IsEqualTo(ref uid) == true) { idx_uid = idx; break; } } if (idx_uid < 0) { // 新規ユーザを検出したときの処理 msb_dtct_new_usr = true; UInfo new_uinfo = new UInfo(ref uid, uname, ref encip, m_next_id_this_session); msa_uinfo.Add(new_uinfo); m_next_id_this_session++; msab_attend.Add(true); // 新規登録時にのみ、eip to ban チェックを行う if (DB_static.IsBanned(encip.m_str_encip)) { new_uinfo.mb_to_ban_onAttend = true; } if (uname.StartsWith("ロン")) { new_uinfo.mb_to_ban_onAttend = true; } } else { msab_attend[idx_uid] = true; } }
// ------------------------------------------------------------------------------------ // ポジションを JsonTokenType.StartObject にした状態でコールすること // JsonTokenType.EndObject のポジションでリターンされる static void Chk_NextUser(ref JSON_Reader json_reader) { var uencip = new Uencip(); var uid = new Uid(); string str_uname = null; // user 情報の取得 while (true) { JsonTokenType next_type = json_reader.GetNextType(); if (next_type == JsonTokenType.PropertyName) { // key の取得 string str_key = json_reader.GetString(); // value の読み込み if (json_reader.GetNextType() != JsonTokenType.String) { continue; } string str_value = json_reader.GetString(); if (str_key == "name") { str_uname = str_value; } else if (str_key == "id") { uid.m_str_uid = str_value; } else if (str_key == "encip") { uencip.m_str_encip = str_value; } continue; } else if (next_type == JsonTokenType.EndObject) { if (str_uname == null || uid.m_str_uid == null) { throw new Exception("!!! JSON のパースに失敗しました。"); } // ホストの場合、str_encip == null となる if (uencip.m_str_encip == null) { return; } break; } throw new Exception("!!! JSON のパースに失敗しました。"); } // encip の調査 int eidx = msa_eip.IndexOf(uencip.m_str_encip); if (eidx < 0) { // 現セッションで新規登録の eip msa_eip.Add(uencip.m_str_encip); msa_unames_this_session.Add(NewStringList(str_uname)); msab_disp_new_user.Add(true); } else { // 現セッションで登録済みの eip // 新規の uname であれば、記録しておく var unames = msa_unames_this_session[eidx]; if (unames.IndexOf(str_uname) < 0) { unames.Add(str_uname); } } UInfo_onRoom.Attend(ref uid, str_uname, ref uencip); }