private void BulletIcon_OnClick(EventContext context) { this.m_infoTip.visible = true; this.m_infoTip.GetChild("bg").onClick.Set(() => { this.m_infoTip.visible = false; }); GComponent tip = this.m_infoTip.GetChild("InfoTip").asCom; tip.x = context.inputEvent.x; tip.y = context.inputEvent.y; BulletCfg bulletInfo = ((context.sender as GLoader).parent.data) as BulletCfg; tip.GetChild("n2").asLoader.url = bulletInfo.Icon; tip.GetChild("n4").asTextField.text = bulletInfo.Name(); tip.GetChild("n6").asTextField.text = bulletInfo.Type(); tip.GetChild("n8").asTextField.text = Message.Get(1088); GList attrList = tip.GetChild("n7").asList; attrList.numItems = 3; attrList.GetChildAt(0).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1089)} +{bulletInfo.Attack}"; attrList.GetChildAt(1).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1091)} +{bulletInfo.SunderArmor}"; attrList.GetChildAt(2).asCom.GetChild("n0").asTextField.text = $"{Message.Get(1092)} {bulletInfo.LoadingSpeed}"; attrList.ResizeToFit(3); }
private void BulletItemRender() { IConfig[] configs = Game.Scene.GetComponent <ConfigComponent>().GetAll(typeof(BulletCfg)); this.m_itemList.RemoveChildrenToPool(); for (int i = 0; i < configs.Length; i++) { BulletCfg bulletInfo = configs[i] as BulletCfg; if (bulletInfo.CanBuy == 0) { continue; } GComponent com = this.m_itemList.AddItemFromPool().asCom; com.GetChild("n11").text = bulletInfo.Name(); com.GetChild("n7").text = bulletInfo.Price.ToString(); com.GetChild("n15").asLoader.url = bulletInfo.Icon; com.GetChild("n15").asLoader.onClick.Set(this.BulletIcon_OnClick); com.GetChild("n12").text = Message.Get(1075); com.GetChild("n12").asButton.onClick.Set(() => { Send_C2G_OptGood(GoodType.Bullet, (int)bulletInfo.Id); }); com.data = bulletInfo; } }