public void AutoBuy() { uint num = 99; uint itm_tpid = GetFeedItemTpid(); a3_BagModel bag = a3_BagModel.getInstance(); a3_ItemData itmdata = bag.getItemDataById(itm_tpid); long money = num * itmdata.on_sale; if (PlayerModel.getInstance().money < money) { int i = (int)PlayerModel.getInstance().money / itmdata.on_sale; if (i > 0) { Shop_a3Proxy.getInstance().BuyStoreItems(itm_tpid, (uint)i); flytxt.instance.fly(ContMgr.getCont("petmodel_addfood", new List <string> { i.ToString(), itmdata.item_name.ToString() })); // flytxt.instance.fly("成功补充了" + i + "个" + itmdata.item_name); } else if (i <= 0) { flytxt.instance.fly(ContMgr.getCont("petmodel_nofood")); //flytxt.instance.fly("金币不足,补充宠物饲料失败"); } } else { Shop_a3Proxy.getInstance().BuyStoreItems(itm_tpid, num); flytxt.instance.fly(ContMgr.getCont("petmodel_addfood", new List <string> { num.ToString(), itmdata.item_name.ToString() })); //flytxt.instance.fly("成功补充了" + num + "个" + itmdata.item_name); } }
public override void onShowed() { a3_BagModel bag = a3_BagModel.getInstance(); itmdata = bag.getItemDataById(itm_tpid); Image icon = getComponentByPath <Image>("iconimage/icon"); icon.sprite = GAMEAPI.ABUI_LoadSprite(itmdata.file); Image iconborder = getComponentByPath <Image>("iconimage/iconborder"); iconborder.sprite = GAMEAPI.ABUI_LoadSprite(itmdata.borderfile); getComponentByPath <Text>("nimg/name").text = itmdata.item_name; getComponentByPath <Text>("desc").text = itmdata.desc; slider.minValue = min_num; slider.maxValue = max_num; uint num = (uint)slider.value; getComponentByPath <Text>("num").text = num.ToString(); long money = num * itmdata.on_sale; getComponentByPath <Text>("money").text = money.ToString(); }
public override void init() { a3_hudun._instance = this; this.btnClose = new BaseButton(base.getTransformByPath("btn_close"), 1, 1); this.btnClose.onClick = new Action <GameObject>(this.OnCLoseClick); this.btnUpLevel = new BaseButton(base.getTransformByPath("ig_bg1/qianghua"), 1, 1); this.btnUpLevel.onClick = new Action <GameObject>(this.UpLevel); this.btnAddEnergy = new BaseButton(base.getTransformByPath("ig_bg1/chongneng"), 1, 1); this.btnAddEnergy.onClick = new Action <GameObject>(this.AddEnergy); new BaseButton(base.getTransformByPath("ig_bg1/help"), 1, 1).onClick = new Action <GameObject>(this.onHelp); new BaseButton(base.getTransformByPath("ig_bg1/tishi/close"), 1, 1).onClick = new Action <GameObject>(this.close_tishi); this.huDunLevel = base.getComponentByPath <Text>("ig_bg1/top/topImage/Text"); this.huDunCount = base.getComponentByPath <Text>("ig_bg1/top/shuzhi"); this.mjCount = base.getComponentByPath <Text>("ig_bg1/mjText/count"); this.isAuto = base.getComponentByPath <Toggle>("ig_bg1/Toggle"); this.bar = base.getComponentByPath <Image>("ig_bg1/bar/bar_n"); this.isAuto.onValueChanged.AddListener(new UnityAction <bool>(this.add_isAuto)); this.HudunModel = ModelBase <HudunModel> .getInstance(); this.playerModel = ModelBase <PlayerModel> .getInstance(); this.hudunProxy = BaseProxy <A3_HudunProxy> .getInstance(); this.bagModel = ModelBase <a3_BagModel> .getInstance(); this.hudunProxy.sendinfo(0); base.transform.FindChild("ig_bg_bg").gameObject.SetActive(false); this.updata_hd(this.HudunModel.NowCount); base.init(); }
public override void init() { _instance = this; btnClose = new BaseButton(this.getTransformByPath("btn_close")); btnClose.onClick = OnCLoseClick; btnUpLevel = new BaseButton(this.getTransformByPath("ig_bg1/qianghua")); btnUpLevel.onClick = UpLevel; btnAddEnergy = new BaseButton(this.getTransformByPath("ig_bg1/chongneng")); btnAddEnergy.onClick = AddEnergy; new BaseButton(this.getTransformByPath("ig_bg1/help")).onClick = onHelp; new BaseButton(this.getTransformByPath("ig_bg1/tishi/close")).onClick = close_tishi; huDunLevel = this.getComponentByPath <Text>("ig_bg1/top/topImage/Text"); huDunCount = this.getComponentByPath <Text>("ig_bg1/top/shuzhi"); mjCount = this.getComponentByPath <Text>("ig_bg1/mjText/count"); isAuto = this.getComponentByPath <Toggle>("ig_bg1/Toggle"); bar = this.getComponentByPath <Image>("ig_bg1/bar/bar_n"); isAuto.onValueChanged.AddListener(add_isAuto); HudunModel = HudunModel.getInstance(); playerModel = PlayerModel.getInstance(); hudunProxy = A3_HudunProxy.getInstance(); bagModel = a3_BagModel.getInstance(); hudunProxy.sendinfo(0); transform.FindChild("ig_bg_bg").gameObject.SetActive(false); updata_hd(HudunModel.NowCount); base.init(); }
public void AutoBuy() { uint num = 99u; uint feedItemTpid = this.GetFeedItemTpid(); a3_BagModel instance = ModelBase <a3_BagModel> .getInstance(); a3_ItemData itemDataById = instance.getItemDataById(feedItemTpid); long num2 = (long)((ulong)num * (ulong)((long)itemDataById.on_sale)); bool flag = (ulong)ModelBase <PlayerModel> .getInstance().money < (ulong)num2; if (flag) { int num3 = (int)(ModelBase <PlayerModel> .getInstance().money / (uint)itemDataById.on_sale); bool flag2 = num3 > 0; if (flag2) { BaseProxy <Shop_a3Proxy> .getInstance().BuyStoreItems(feedItemTpid, (uint)num3); flytxt.instance.fly(ContMgr.getCont("petmodel_addfood", new List <string> { num3.ToString(), itemDataById.item_name.ToString() }), 0, default(Color), null); } else { bool flag3 = num3 <= 0; if (flag3) { flytxt.instance.fly(ContMgr.getCont("petmodel_nofood", null), 0, default(Color), null); } } } else { BaseProxy <Shop_a3Proxy> .getInstance().BuyStoreItems(feedItemTpid, num); flytxt.instance.fly(ContMgr.getCont("petmodel_addfood", new List <string> { num.ToString(), itemDataById.item_name.ToString() }), 0, default(Color), null); } }
public void onSellItems(Variant data) { int num = data["res"]; bool flag = num < 0; if (!flag) { bool flag2 = num == 1; if (flag2) { uint num2 = data["id"]; uint num3 = data["earn"]; MediaClient.instance.PlaySoundUrl("audio/common/sold_coin", false, null); } else { bool flag3 = num == 2; if (flag3) { uint num4 = data["earn"]; MediaClient.instance.PlaySoundUrl("audio/common/sold_coin", false, null); bool flag4 = a3_bag.indtans != null; if (flag4) { a3_bag.indtans.refresh_Sell(); } bool flag5 = InterfaceMgr.getInstance().checkWinOpened(InterfaceMgr.A3_SMITHY) && A3_Smithy.Instance != null; if (flag5) { A3_Smithy.Instance.refresh_Sell(); } } } a3_BagModel expr_E2 = ModelBase <a3_BagModel> .getInstance(); if (expr_E2 != null) { expr_E2.SellItem(); } base.dispatchEvent(GameEvent.Create(BagProxy.EVENT_ITME_SELL, this, data, false)); } }
public override void onShowed() { a3_BagModel instance = ModelBase <a3_BagModel> .getInstance(); this.itmdata = instance.getItemDataById(a3_store.itm_tpid); Image componentByPath = base.getComponentByPath <Image>("iconimage/icon"); componentByPath.sprite = (Resources.Load(this.itmdata.file, typeof(Sprite)) as Sprite); Image componentByPath2 = base.getComponentByPath <Image>("iconimage/iconborder"); componentByPath2.sprite = (Resources.Load(this.itmdata.borderfile, typeof(Sprite)) as Sprite); base.getComponentByPath <Text>("nimg/name").text = this.itmdata.item_name; base.getComponentByPath <Text>("desc").text = this.itmdata.desc; this.slider.minValue = a3_store.min_num; this.slider.maxValue = a3_store.max_num; uint num = (uint)this.slider.value; base.getComponentByPath <Text>("num").text = num.ToString(); long num2 = (long)((ulong)num * (ulong)((long)this.itmdata.on_sale)); base.getComponentByPath <Text>("money").text = num2.ToString(); }