public override void OnCreate() { base.OnCreate(); AutoInject.Inject(Panel, this); var text = this.okBtn.name; GameObject okBtn = Panel.FindChildByPath("bottom/okBtn"); CommonHelper.AddBtnMsg(okBtn, (obj) => { }); }
public override void OnCreate() { base.OnCreate(); AutoInject.Inject(Panel, this); var text = this.okBtn.name; uiHintTest = new UIHintTest(); AttachSubPanel("center/uiTextHint", uiHintTest, UILevel.Level2); GameObject okBtn = Panel.FindChildByPath("bottom/okBtn"); Image titleImage = Panel.GetComponentByPath <Image>("logo"); CommonHelper.AddBtnMsg(okBtn, (obj) => { if (obj.name == "okBtn") { // CommonHelper.SetImageSpriteFromAtlas(2001, titleImage, "airfightSheet_3", false); Texture2D texture2D = ResourceMgr.GetInstance().GetResourceById <Texture2D>(400002); Sprite sprite = CommonHelper.SliceTextureToSprite(texture2D, 200, 300, 600, 100); titleImage.sprite = sprite; } }); }