public void reset(s_t_shop t_shop) { m_t_shop = t_shop; m_num.SetActive(true); m_num.GetComponent <UILabel> ().text = m_t_shop.price.ToString(); if (m_t_shop.type == 1) { m_yuan.SetActive(true); m_icon.SetActive(false); if (m_t_shop.ios_desc != "") { m_desc.GetComponent <UILabel>().text = m_t_shop.ios_desc; m_desc.SetActive(true); m_yuan.SetActive(false); m_num.SetActive(false); } } else { m_yuan.SetActive(false); m_icon.SetActive(true); } this.GetComponent <UISprite> ().spriteName = m_t_shop.db; m_tb.GetComponent <UISprite> ().spriteName = m_t_shop.icon; m_tb.GetComponent <UISprite> ().MakePixelPerfect(); m_title.GetComponent <UILabel> ().text = m_t_shop.name; }
//定额支付接口 public void pay(s_t_shop t_shop) { #if UNITY_ANDROID mario._instance.wait(true); m_t_shop = t_shop; androidContext().Call("pay", mario._instance.m_self.openid, t_shop.price, t_shop.id, t_shop.desc, t_shop.code, mario._instance.m_self.notify_uri); #endif }
public void reset(int index) { m_index = index; this.gameObject.SetActive(true); m_ss [m_index].GetComponent <UIToggle> ().value = true; mario._instance.remove_child(m_shop_view); #if UNITY_IPHONE recharge_iphone._instance.init(); if (!m_shop_init && index == 0) { recharge_iphone._instance.req_info(); return; } #elif UNITY_ANDROID if (!Application.isEditor && !m_shop_init && index == 0) { LJSDK._instance.req_info(); return; } #elif UNITY_WEBPLAYER if (!Application.isEditor && !m_shop_init && index == 0) { if (game_data._instance.m_channel == "web_facebook") { LJSDK._instance.req_info(); return; } } #endif m_shop_items.Clear(); int num = 0; foreach (KeyValuePair <int, s_t_shop> kv in game_data._instance.m_t_shop) { s_t_shop t_shop = kv.Value; if (t_shop.slot == index) { GameObject obj = (GameObject)Instantiate(m_sub_shop); obj.transform.parent = m_shop_view.transform; obj.transform.localPosition = new Vector3(-310 + num * 200, 0, 0); obj.transform.localScale = new Vector3(1, 1, 1); obj.GetComponent <UIButtonMessage>().target = this.gameObject; obj.GetComponent <shop_sub>().reset(t_shop); obj.SetActive(true); m_shop_items.Add(obj); num++; } } m_shop_view.GetComponent <UIScrollView> ().ResetPosition(); }
void click_item(GameObject obj) { s_t_shop t_shop = obj.GetComponent <shop_sub>().m_t_shop; m_buy_id = t_shop.id; if (t_shop.type == 1) { if (Application.isEditor) { return; } #if UNITY_IPHONE recharge_iphone._instance.buy(t_shop); #elif UNITY_ANDROID LJSDK._instance.pay(t_shop); #elif UNITY_WEBPLAYER string order = mario._instance.m_self.userid.ToString() + timer.now().ToString(); Application.ExternalCall("show_recharge", order, t_shop.desc, t_shop.price, mario._instance.m_self.notify_uri, mario._instance.m_self.openid); mario._instance.wait(true); #elif UNITY_STANDALONE_WIN string order = mario._instance.m_self.userid.ToString() + timer.now().ToString(); string url = string.Format("http://mario.web.yymoon.com/recharge/pay.php?WIDout_trade_no={0}&WIDsubject={1}&WIDtotal_fee={2}&WINotify_url={3}&WIextra_common_param={4}", order, t_shop.desc, t_shop.price, mario._instance.m_self.notify_uri, mario._instance.m_self.openid); Application.OpenURL(url); s_message mes = new s_message(); mes.m_type = "recharge_web"; mario._instance.show_double_dialog_box(game_data._instance.get_language_string("user_gui_zfdd"), mes, null); #endif return; } if (t_shop.type != 1 && mario._instance.m_self.jewel < t_shop.price) { mario._instance.show_tip(game_data._instance.get_language_string("user_gui_zsbz")); return; } protocol.game.cmsg_shop_buy msg = new protocol.game.cmsg_shop_buy(); msg.id = t_shop.id; net_http._instance.send_msg <protocol.game.cmsg_shop_buy>(opclient_t.OPCODE_SHOP_BUY, msg); }
public void buy(s_t_shop t_shop) { m_t_shop = t_shop; BuyProduct(m_t_shop.code); mario._instance.wait(true); }
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(); }
public void net_message(s_net_message message) { if (message.m_opcode == opclient_t.OPCODE_SHOP_BUY || message.m_opcode == opclient_t.OPCODE_GOOGLE_PAY) { s_t_shop t_shop = game_data._instance.get_t_shop(m_buy_id); if (t_shop.type != 1) { mario._instance.m_self.jewel -= t_shop.price; mario_tool._instance.onJewelConsume(t_shop.desc, t_shop.price); } mario._instance.show_tip(game_data._instance.get_language_string("user_gui_hd") + t_shop.name); if (t_shop.type == 1) { mario._instance.m_self.jewel += t_shop.def; mario_tool._instance.onJewelGet(t_shop.desc, t_shop.def); } else if (t_shop.type == 2) { } else if (t_shop.type == 3) { mario._instance.m_self.testify = t_shop.def; } else if (t_shop.type == 4) { if (mario._instance.m_self.exp_time > timer.now()) { mario._instance.m_self.exp_time += (ulong)t_shop.def * 86400000; } else { mario._instance.m_self.exp_time = timer.now() + (ulong)t_shop.def * 86400000; } } for (int i = 0; i < m_shop_items.Count; ++i) { m_shop_items[i].GetComponent <shop_sub>().reset(); } } if (message.m_opcode == opclient_t.OPCODE_PAY) { if (message.m_res == -1) { #if UNITY_ANDROID m_pay_time = 5; mario._instance.wait(true); #elif UNITY_WEBPLAYER || UNITY_STANDALONE_WIN s_message mes = new s_message(); mes.m_type = "recharge_web"; mario._instance.show_double_dialog_box(game_data._instance.get_language_string("user_gui_wzfdd"), mes, null); #endif } else { protocol.game.smsg_pay _msg = net_http._instance.parse_packet <protocol.game.smsg_pay> (message.m_byte); mario._instance.show_tip(string.Format(game_data._instance.get_language_string("user_gui_hdzs"), _msg.jewel)); mario._instance.m_self.jewel += _msg.jewel; mario_tool._instance.onJewelGet("安卓支付", _msg.jewel); } } }