public static void ShowBoxTips(string currInfo, float timeVis, float duration) { GameObject obj = GameMethod.CreateWindow(GameConstDefine.MessageTipUI, new Vector3(0, -1, 0), GameMethod.GetUiCamera.transform); UIMessageTip uims = obj.GetComponent <UIMessageTip>(); uims.SetCapionInfo(currInfo, timeVis); UICommonMethod.TweenPositionBegin(obj, duration, Vector3.zero, UITweener.Style.Once); }
void ItemMove(GameObject obj, Vector2 pos) { if (objMove == null || !isMove) { return; } Vector3 newPos = UICommonMethod.GetWorldPos(pos); objMove.transform.position = newPos; }
void SetVisiable(bool visiable) { if (visiable) { UICommonMethod.TweenColorBegin(gameObject, 3f, 1); } else { UICommonMethod.TweenColorBegin(gameObject, 3f, 0.5f); } }
void SetPointPos(Vector2 pos) { Vector3 newPos = UICommonMethod.GetWorldSpacePos(pos) + new Vector3(0f, 0f, m_point.position.z); if (Vector3.Distance(newPos, transform.position) > m_adjustRadius) { Vector3 direction = newPos - transform.position; direction.Normalize(); direction *= m_adjustRadius; newPos = transform.position + direction; } m_point.position = newPos; }
void SetVisiable(bool visiable) { if (visiable) { UICommonMethod.TweenColorBegin(gameObject, 0f, 1f); } else { UICommonMethod.TweenColorBegin(gameObject, 0f, 0.5f); transform.localPosition = orignalPos; point.localPosition = Vector3.zero; } }
//设置遥感位置 void SetPointPos(Vector2 pos) { //根据屏幕坐标获取世界坐标的位置 Vector3 newPos = UICommonMethod.GetWorldPos(pos) + new Vector3(0f, 0f, point.position.z); //当移动的距离大于边界时 if (Vector3.Distance(newPos, transform.position) > adjustRadius) { Vector3 direction = newPos - transform.position; //获得方向 direction.Normalize(); //归一化 direction *= adjustRadius; //防止遥感越过遥感边界 newPos = transform.position + direction; //设置遥感位置 } //否则直接为遥感设置位置 Point是可移动的中心位置的的对象 point.position = newPos; }
//切入动画设置 选择状态设置为进入状态 void InitFlash() { UpdateLock();//更新英雄选择栏的英雄锁定显示 Vector3 orginalLeft = mTeamLeft.localPosition; Vector3 orginalRight = mTeamRight.localPosition; mTeamLeft.localPosition = new Vector3(orginalLeft.x - mMove, orginalLeft.y, orginalLeft.z); mTeamRight.localPosition = new Vector3(orginalRight.x + mMove, orginalRight.y, orginalRight.z); mTween1 = TweenPosition.Begin(mTeamLeft.gameObject, 0.5f, orginalLeft); mTween2 = TweenPosition.Begin(mTeamRight.gameObject, 0.5f, orginalRight); UICommonMethod.TweenAlphaBegin(mShowAlpha.gameObject, 0f, 0f); mTweenAlpha = UICommonMethod.TweenAlphaBegin(mShowAlpha.gameObject, 1.7f, 1f); mTween1.method = UITweener.Method.EaseIn; mTween2.method = UITweener.Method.EaseIn; mSelectIndex = -1; SetSelectHeroState(SelectHeroState.EnterSelect); }
/// <summary> /// 显示摇杆 /// </summary> void ShowStick() { if (canUse == false) { return; } //PlayerManager.Instance.LocalPlayer.MoveCount = -1; Vector2 touchPos = UICamera.currentTouch.pos; SetPointPos(touchPos); VirtualStickState = StickState.MoveState; //SendMove(); transform.position = new Vector3(UICommonMethod.GetWorldPos(touchPos).x, UICommonMethod.GetWorldPos(touchPos).y, transform.position.z); point.localPosition = Vector3.zero; //VirtualStickState = StickState.ActiveState; SetVisiable(true); }
/// <summary> /// 显示摇杆 /// </summary> void ShowStick() { if (canUse == false) { return; } Vector2 touchPos = UICamera.currentTouch.pos; SetPointPos(touchPos); VirtualStickState = StickState.MoveState;//遥感移动状态 //位置设置 transform.position = new Vector3(UICommonMethod.GetWorldPos(touchPos).x, UICommonMethod.GetWorldPos(touchPos).y, transform.position.z); point.localPosition = Vector3.zero; //颜色变亮 SetVisiable(true); }
void InitFlash() { UpdateLock(); Vector3 orginalLeft = mTeamLeft.localPosition; Vector3 orginalRight = mTeamRight.localPosition; mTeamLeft.localPosition = new Vector3(orginalLeft.x - mMove, orginalLeft.y, orginalLeft.z); mTeamRight.localPosition = new Vector3(orginalRight.x + mMove, orginalRight.y, orginalRight.z); mTween1 = TweenPosition.Begin(mTeamLeft.gameObject, 0.5f, orginalLeft); mTween2 = TweenPosition.Begin(mTeamRight.gameObject, 0.5f, orginalRight); UICommonMethod.TweenAlphaBegin(mShowAlpha.gameObject, 0f, 0f); mTweenAlpha = UICommonMethod.TweenAlphaBegin(mShowAlpha.gameObject, 1.7f, 1f); mTween1.method = UITweener.Method.EaseIn; mTween2.method = UITweener.Method.EaseIn; mSelectIndex = -1; // EventDelegate.Add(tweenAlpha.onFinished, FinishTween); SetSelectHeroState(SelectHeroState.EnterSelect); // EnableToggle(false); }