IEnumerator _showTxt; //逐字显示对话内容的协程 //private ButtonTouch attackButton;//攻击按钮 //float spd = 5;//弹出速度 //bool txtEnd;//判断当前文字是否显示完毕 //Gradient GCColor;//渐变颜色控制 private void Initialize()//初始化 { player = GameObject.FindObjectOfType <PlayCharacter>(); if (null == chatRect) { GameObject _chatRect = Resources.Load <GameObject>("Prefabs/GameUI-ChatRect"); //读取 chatRect = Instantiate(_chatRect).GetComponent <Image>(); //实例化,赋值 chatRect.transform.SetParent(GameManager.Instance.UICanvas, false); //设置为画布的子物体 chatRect.GetComponent <ButtonNormal>().onClick.AddListener(clickChatRect); //添加横幅的点击事件 a_rect = chatRect.color.a; chatRect.color -= new Color(0, 0, 0, a_rect); //全透明化 } //获取对象 //Chat_Button = GameObject.Find("Canvas/Buttons/Button_Chat").GetComponent<ButtonNormal>(); Chat_Name = chatRect.transform.GetChild(0).GetComponent <Image>(); a_name = Chat_Name.color.a; Chat_Text = chatRect.transform.GetChild(1).GetComponent <Text>(); Chat_Head = chatRect.transform.GetChild(2).GetComponent <RectTransform>(); touch_Control = GameObject.FindObjectOfType <TouchControl>(); gCtrl = GameObject.FindObjectOfType <GameControl>(); attackButton = GameObject.FindObjectOfType <ButtonAttack>(); Chat_Button = attackButton.transform.parent.Find("ButtonChat").GetComponent <ButtonNormal>(); Chat_Button.onClick.AddListener(EnterChat);//添加点击事件 //attackButton = GameObject.FindObjectOfType<ButtonTouch>(); }
void Awake() { //获取变量 //items = GetComponentsInChildren<ItemGrid>(); //获取信息框 info_Name = info.GetChild(1).GetComponentInChildren <Text>(); info_Detail = info.GetChild(2).GetComponentInChildren <Text>(); info_Image = info.GetChild(0).GetComponent <Image>(); info_Image.color = new Color(1, 1, 1, 0); info_Btn = info.GetComponentInChildren <ButtonNormal>(); info_Btn.gameObject.SetActive(false);//隐藏按钮 //print("Length of Items: "+items.Length); player = GameObject.FindWithTag("Player").GetComponent <PlayCharacter>(); cnsmbs = BagManager.Instance.LoadConsumByXml(); if (null == cnsmbs || cnsmbs.Count < 1)//如果没有 { info_Detail.text = "没有任何物品"; info_Image.color = new Color(1, 1, 1, 0); delete_Btn.gameObject.SetActive(false); sort_Btn.gameObject.SetActive(false); return; } else { GetItems(); } //初始未选 //InselectAll(); }
public void ShowPop() //显示气泡 { //播放动画 StopAllCoroutines(); StartCoroutine(FadeIn()); //启用按钮 ButtonNormal btn = GetComponent <ButtonNormal>(); if (btn != null) { btn.interactable = true; } }
public void HidePop() //隐藏气泡 { //播放动画 StopAllCoroutines(); StartCoroutine(FadeOut()); //禁用按钮 ButtonNormal btn = GetComponent <ButtonNormal>(); if (btn != null) { btn.interactable = false; } }
// Use this for initialization void Awake() { //SkillImg = transform.Find("Icon").GetComponent<Image>(); //buttonSprite1 = skillIcon.sprite; TimeTip = GetComponentInChildren <Text>(); CdProgress = transform.Find("CdProgress").GetComponent <Image>(); btn = GetComponent <ButtonNormal>(); //fatherImage = transform.parent.GetComponent<Image>(); //开始时可以释放第一段 //buttonImg.sprite = buttonSprite1Plus; fstPart = true; }
ButtonNormal HeadIcon; //头像图标 // Use this for initialization void Start() { tchScrn = GameObject.Find("Canvas/TouchControl").GetComponent <TouchControl>(); bkgImg = GetComponent <Image>(); //clckPanel = GetComponent<ClickPanel>(); //添加事件 onClickOrEsc.AddListener(DisplayWindow_Option); Time.timeScale = 1; //gameState = GameState.gaming; //获取玩家 player = GameObject.FindObjectOfType <PlayCharacter>(); HeadIcon = GameObject.Find("Canvas/Head").GetComponent <ButtonNormal>(); //重新读取界面信息 GameManager.Instance.loadCanvas(); //获取画布 cvs = GameManager.Instance.UICanvas; }
// Use this for initialization void Awake() { defaultPos = transform.localPosition;//记录初始位置 btn = GetComponent <ButtonNormal>(); //如果没有按钮组件,则图片为自身,反之则为子物体 //if (null == btn) skillIcon = GetComponent<Image>(); if (null == skillIcon) { skillIcon = transform.GetChild(0).GetComponent <Image>(); } normalColor = skillIcon.color;//记录颜色 //CdImg = transform.Find("CdImg").GetComponent<Image>(); CdProgress = transform.Find("CdProgress").GetComponent <Image>(); if (null == CdProgress) { CdProgress = GetComponent <Image>(); //如果没有子物体,选择自身 } //normalColor = CdImg.color; timeTip = this.GetComponentInChildren <Text>(); //if(!enable)ResetCD(); //else EnableSkill(); //colorStep = (normalColor - DisabledColor) * Time.deltaTime / cdTime; }