public void add_job_exp(int e) { job_exp += e; s_t_job_exp t_job_exp = game_data._instance.get_t_job_exp(job_level + 1); while (t_job_exp != null && job_exp >= t_job_exp.exp) { job_exp -= t_job_exp.exp; job_level++; t_job_exp = game_data._instance.get_t_job_exp(job_level + 1); } }
void reset_exp() { m_level.GetComponent <UILabel> ().text = mario._instance.m_self.job_level.ToString(); s_t_job_exp t_job_exp = game_data._instance.get_t_job_exp(mario._instance.m_self.job_level + 1); if (t_job_exp != null) { float v = (float)mario._instance.m_self.job_exp / t_job_exp.exp; m_exp_bar.GetComponent <UIProgressBar>().value = v; m_exp_text.GetComponent <UILabel>().text = mario._instance.m_self.job_exp.ToString() + "/" + t_job_exp.exp.ToString(); } else { m_exp_bar.GetComponent <UIProgressBar>().value = 1; m_exp_text.GetComponent <UILabel>().text = mario._instance.m_self.job_exp.ToString() + "/--"; } t_job_exp = game_data._instance.get_t_job_exp(mario._instance.m_self.job_level); }
public void reset(protocol.game.smsg_view_player msg) { m_msg = msg; m_name.GetComponent <UILabel>().text = player.get_name(m_msg.data.userid, m_msg.data.name, m_msg.data.visitor); m_touxiang.GetComponent <UISprite> ().spriteName = game_data._instance.get_t_touxiang(m_msg.data.head); m_guojia.GetComponent <UISprite> ().spriteName = game_data._instance.get_t_guojia(m_msg.data.country); s_t_exp t_exp = game_data._instance.get_t_exp(m_msg.data.level); m_level.GetComponent <UISprite>().spriteName = t_exp.icon; m_level_text.GetComponent <UILabel>().text = m_msg.data.level.ToString(); t_exp = game_data._instance.get_t_exp(m_msg.data.level + 1); if (t_exp != null) { float v = (float)m_msg.data.exp / t_exp.exp; m_exp_bar.GetComponent <UIProgressBar>().value = v; m_exp_text.GetComponent <UILabel>().text = m_msg.data.exp.ToString() + "/" + t_exp.exp.ToString(); } else { m_exp_bar.GetComponent <UIProgressBar>().value = 1; m_exp_text.GetComponent <UILabel>().text = m_msg.data.exp.ToString() + "/--"; } m_job_level.GetComponent <UILabel>().text = "Lv" + m_msg.data.mlevel.ToString(); s_t_job_exp t_job_exp = game_data._instance.get_t_job_exp(m_msg.data.mlevel + 1); if (t_job_exp != null) { float v = (float)m_msg.data.mexp / t_job_exp.exp; m_job_exp_bar.GetComponent <UIProgressBar>().value = v; m_job_exp_text.GetComponent <UILabel>().text = m_msg.data.mexp.ToString() + "/" + t_job_exp.exp.ToString(); } else { m_job_exp_bar.GetComponent <UIProgressBar>().value = 1; m_job_exp_text.GetComponent <UILabel>().text = m_msg.data.mexp.ToString() + "/--"; } m_time.GetComponent <UILabel>().text = m_msg.data.register; m_ztz.GetComponent <UILabel> ().text = m_msg.data.amount.ToString("N0"); m_ztg.GetComponent <UILabel>().text = m_msg.data.pas.ToString("N0"); m_zfs.GetComponent <UILabel>().text = m_msg.data.point.ToString("N0"); m_zpl.GetComponent <UILabel>().text = m_msg.data.comment.ToString("N0"); m_gk.GetComponent <UILabel>().text = m_msg.data.video.ToString("N0"); m_bgk.GetComponent <UILabel>().text = m_msg.data.watched.ToString("N0"); mario._instance.remove_child(m_jqwg_s); if (msg.recent.Count == 0) { m_jqwg_t.SetActive(true); m_jqwg_s.GetComponent <UISprite>().height = 140; } else { m_jqwg_t.SetActive(false); for (int i = 0; i < msg.recent.Count; ++i) { GameObject obj = (GameObject)Instantiate(m_player_sub); obj.transform.parent = m_jqwg_s.transform; obj.transform.localPosition = new Vector3(0, -53 - 95 * i, 0); obj.transform.localScale = new Vector3(1, 1, 1); obj.GetComponent <player_sub>().reset(1, msg.recent[i].id, msg.recent[i].name, msg.recent[i].url, msg.recent[i].rank, msg.recent[i].time, this.gameObject); obj.SetActive(true); } m_jqwg_s.GetComponent <UISprite>().height = 95 * msg.recent.Count + 10; } mario._instance.remove_child(m_tscd_s); if (msg.upload.Count == 0) { m_tscd_t.SetActive(true); m_tscd_s.GetComponent <UISprite>().height = 140; } else { m_tscd_t.SetActive(false); for (int i = 0; i < msg.upload.Count; ++i) { GameObject obj = (GameObject)Instantiate(m_player_sub); obj.transform.parent = m_tscd_s.transform; obj.transform.localPosition = new Vector3(0, -53 - 95 * i, 0); obj.transform.localScale = new Vector3(1, 1, 1); obj.GetComponent <player_sub>().reset(2, msg.upload[i].id, msg.upload[i].name, msg.upload[i].url, 0, msg.upload[i].time, this.gameObject); obj.SetActive(true); } m_tscd_s.GetComponent <UISprite>().height = 95 * msg.upload.Count + 10; } mario._instance.remove_child(m_wgzd_s); if (msg.play.Count == 0) { m_wgzd_t.SetActive(true); m_wgzd_s.GetComponent <UISprite>().height = 140; } else { m_wgzd_t.SetActive(false); for (int i = 0; i < msg.play.Count; ++i) { GameObject obj = (GameObject)Instantiate(m_player_sub); obj.transform.parent = m_wgzd_s.transform; obj.transform.localPosition = new Vector3(0, -53 - 95 * i, 0); obj.transform.localScale = new Vector3(1, 1, 1); obj.GetComponent <player_sub>().reset(3, msg.play[i].id, msg.play[i].name, msg.play[i].url, msg.play[i].play, "", this.gameObject); obj.SetActive(true); } m_wgzd_s.GetComponent <UISprite>().height = 95 * msg.play.Count + 10; } m_view.GetComponent <UIScrollView> ().ResetPosition(); }
public void init() { load_native(); dbc tdbc = new dbc(); tdbc.load_txt("t_language"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_language t_l = new s_t_language(); t_l.id = tdbc.get(0, i); t_l.zw = tdbc.get(1, i); t_l.ew = tdbc.get(2, i); m_t_language [t_l.id] = t_l; } tdbc.load_txt("t_unit"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_unit t_unit = new s_t_unit(); t_unit.id = int.Parse(tdbc.get(0, i)); t_unit.name = tdbc.get(1, i); t_unit.icon = tdbc.get(2, i); t_unit.res = tdbc.get(3, i); t_unit.yc = int.Parse(tdbc.get(4, i)); t_unit.kfg = int.Parse(tdbc.get(5, i)); t_unit.is_static = int.Parse(tdbc.get(6, i)); t_unit.fwt = int.Parse(tdbc.get(7, i)); t_unit.review = int.Parse(tdbc.get(8, i)); t_unit.is_sw = int.Parse(tdbc.get(9, i)); t_unit.max_num = int.Parse(tdbc.get(10, i)); m_t_unit [t_unit.id] = t_unit; if (t_unit.yc == 0) { m_unit_sites.Add(t_unit.id); m_unit_num++; } } tdbc.load_txt("t_error"); for (int i = 0; i < tdbc.get_y(); ++i) { int id = int.Parse(tdbc.get(0, i)); string des = get_language_string(tdbc.get(1, i)); m_t_error [id] = des; } tdbc.load_txt("t_view_map"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_view_map t_view = new s_t_view_map(); t_view.id = int.Parse(tdbc.get(0, i)); t_view.name = get_language_string(tdbc.get(1, i)); t_view.icon = tdbc.get(2, i); m_t_view_map [t_view.id] = t_view; } tdbc.load_txt("t_view_title"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_view_title t_view = new s_t_view_title(); t_view.id = int.Parse(tdbc.get(0, i)); t_view.name = get_language_string(tdbc.get(1, i)); t_view.icon = tdbc.get(2, i); m_t_view_title [t_view.id] = t_view; } tdbc.load_txt("t_touxiang"); for (int i = 0; i < tdbc.get_y(); ++i) { int id = int.Parse(tdbc.get(0, i)); string icon = tdbc.get(1, i); m_t_touxiang [id] = icon; } tdbc.load_txt("t_guojia"); for (int i = 0; i < tdbc.get_y(); ++i) { string code = tdbc.get(0, i); string icon = tdbc.get(2, i); m_t_guojia [code] = icon; } tdbc.load_txt("t_exp"); int zm = 0; for (int i = 0; i < tdbc.get_y(); ++i) { s_t_exp t_exp = new s_t_exp(); t_exp.level = int.Parse(tdbc.get(0, i)); t_exp.exp = int.Parse(tdbc.get(1, i)); t_exp.zm = int.Parse(tdbc.get(2, i)); t_exp.icon = tdbc.get(3, i); t_exp.max_exp = int.Parse(tdbc.get(4, i)); m_t_exp [t_exp.level] = t_exp; if (t_exp.zm != zm) { zm = t_exp.zm; m_t_zm [zm] = t_exp.level; } } tdbc.load_txt("t_job_exp"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_job_exp t_job_exp = new s_t_job_exp(); t_job_exp.level = int.Parse(tdbc.get(0, i)); t_job_exp.exp = int.Parse(tdbc.get(1, i)); m_t_job_exp [t_job_exp.level] = t_job_exp; } tdbc.load_txt("t_shop"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_shop t_shop = new s_t_shop(); t_shop.id = int.Parse(tdbc.get(0, i)); t_shop.slot = int.Parse(tdbc.get(1, i)); t_shop.name = get_language_string(tdbc.get(2, i)); t_shop.type = int.Parse(tdbc.get(3, i)); t_shop.price = int.Parse(tdbc.get(4, i)); t_shop.price_my = float.Parse(tdbc.get(5, i)); t_shop.icon = tdbc.get(6, i); t_shop.db = tdbc.get(7, i); t_shop.def = int.Parse(tdbc.get(8, i)); t_shop.code = tdbc.get(9, i); t_shop.desc = get_language_string(tdbc.get(10, i)); m_t_shop [t_shop.id] = t_shop; } tdbc.load_txt("t_fg"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_fg t_fg = new s_t_fg(); t_fg.id = int.Parse(tdbc.get(0, i)); t_fg.name = get_language_string(tdbc.get(1, i)); t_fg.tj = int.Parse(tdbc.get(2, i)); t_fg.desc = get_language_string(tdbc.get(3, i)); t_fg.music = tdbc.get(4, i); m_t_fg [t_fg.id] = t_fg; m_fg_num++; } tdbc.load_txt("t_map"); for (int i = 0; i < tdbc.get_y(); ++i) { int id = int.Parse(tdbc.get(0, i)); m_t_map.Add(id); } tdbc.load_txt("t_br"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_br t_br = new s_t_br(); t_br.id = int.Parse(tdbc.get(0, i)); t_br.name = get_language_string(tdbc.get(2, i)); t_br.num = int.Parse(tdbc.get(3, i)); t_br.desc = get_language_string(tdbc.get(4, i)); t_br.unlock = get_language_string(tdbc.get(6, i)); m_t_br.Add(t_br); } tdbc.load_txt("t_key"); for (int i = 0; i < tdbc.get_y(); ++i) { s_t_key t_key = new s_t_key(); t_key.code = int.Parse(tdbc.get(0, i)); t_key.name = tdbc.get(1, i); m_t_key.Add(t_key.code, t_key); } new_mission(); if (Application.isEditor) { #if STEAM m_channel = "win_steam"; #else m_channel = ""; #endif } else { #if UNITY_ANDROID LJSDK._instance.init_channel(); m_channel = LJSDK._instance.m_channel; #elif UNITY_IPHONE m_channel = "IOS_yymoon"; #elif UNITY_WEBPLAYER LJSDK._instance.init_channel(); return; #elif UNITY_STANDALONE_WIN #if STEAM m_channel = "win_steam"; #else m_channel = "win_yymoon"; #endif #else m_channel = ""; #endif } init_pt_ver(); }