public void InitExpressionGroup() { for (int i = 1; i <= ExpressionAnimPool._ExpressionAnimCount; i++) { ExpressionAnim anim = ExpressionAnimPool.Ins.Create(i, mExpressionGroupGo.transform); ChatBtnClickEvent clickEvent = new ChatBtnClickEvent(i.ToString(), ChatType.NormalExpression, this); anim.gameObject.AddComponent <Button>().Add(clickEvent.ClickEvent, false); _ExpressionAnims.Add(anim); } }
//显示表情 public void ShowExpression(int expressionIndex) { if (_expressionAnim != null) { _expressionAnim.Destroy(); _expressionAnim = null; } _expressionAnim = ExpressionAnimPool.Ins.Create(expressionIndex, _ExpressionPoint); _expressionAnim.LocalPositionZero(); DelayActionTool.ExecuteDelayAction(DelayActionId.ChatExpressionHide + _Player.ClientSeatIndex, 5000, HideExpression); }
public ExpressionAnim Create(int expressionIndex, Transform expressionParent) { ExpressionAnim expressionAnim; if (_ExpressionAnims.Count > 0) { expressionAnim = _ExpressionAnims[0]; _ExpressionAnims.RemoveAt(0); expressionAnim.Show(_expressionSpriteDic[expressionIndex]); expressionAnim.SetParent(expressionParent); return(expressionAnim); } expressionAnim = new ExpressionAnim(); GameObject expressionAnimGo = GameObject.Instantiate(_ExpressionAnimGoPrefab, expressionParent); expressionAnim.Init(expressionAnimGo.GetComponent <Image>(), _expressionSpriteDic[expressionIndex]); return(expressionAnim); }
//隐藏表情 public void HideExpression() { _expressionAnim.Destroy(); _expressionAnim = null; }
public void DestroyExpression(ExpressionAnim expressionAnim) { _ExpressionAnims.Add(expressionAnim); }