public virtual void SetIsGameOver(bool isGameOver) { //设置按钮 if (isGameOver) { mIsGameOver = true; _startCall = null; } else { _startCall = () => { Hide(); EventDispatch.Dispatch((int)NetEventId.OnGameRestart, new EventData()); }; if (TotalBtn != null) { TotalBtn.gameObject.SetActive(false); if (BtGoOn != null) { BtGoOn.SetActive(true); } } } }
public IEnumerator RotoTo(Vector3 to, float time, float delayTime = 0, DVoidNoParam callBack = null) { if (Math.Abs(delayTime) > 0) { yield return(new WaitForSeconds(delayTime)); } float val = 0; float bTime = Time.time; Quaternion fqua = transform.localRotation; Quaternion tquat = Quaternion.Euler(to); while (val < time) { val = Time.time - bTime; float smoothval = val / time; transform.localRotation = Quaternion.Lerp(fqua, tquat, smoothval); yield return(2); } if (callBack != null) { callBack(); } }
//void Start() //{ // //if (null != GameAdpaterManager.Singleton) // //{ // // GetComponent<RectTransform>().anchoredPosition3D = GameAdpaterManager.Singleton.GetConfig.ChooseCpPnl_Pos; // //} //} public virtual void OnCancelClick() { Reset(); CancelCall(); CancelCall = null; EventDispatch.Dispatch((int)UIEventId.RedisplayButtons); }
protected IEnumerator TimeLoop(float time, DVoidNoParam callBack, int index) { yield return(new WaitForSeconds(time)); callBack(); _dicTimerItem.Remove(index); }
public void ResetPos() { _dv = Nothing; Vector3 v3 = Target.localPosition; v3.y = Situ; Target.localPosition = v3; EventDispatch.Dispatch((int)GameEventId.CleareFlagMahjong, new EventData()); }
private void Down() { Vector3 v3 = Target.localPosition; v3.y += Speed; if (v3.y >= Situ) { _dv = Nothing; v3.y = Situ; } Target.localPosition = v3; }
public void StartTime(int time, DVoidNoParam callBack = null) { YxDebug.Log("开始 计时器"); TimeNum.gameObject.SetActive(true); _time = time; TimeNum.Num = time; if (TimeUpdataCor != null) { StopCoroutine(TimeUpdataCor); } TimeUpdataCor = StartCoroutine(TimeUpdata(callBack)); }
protected int StartTimeLoop(float time, DVoidNoParam callBack) { _index = _ran.Next(); while (_dicTimerItem.ContainsKey(_index)) { _index = _ran.Next(); } Coroutine cor = StartCoroutine(TimeLoop(time, callBack)); _dicTimerItem.Add(_index, new TimerItem(cor, callBack)); return(_index); }
public void RollUp() { if (iconCmp != null) { iconCmp.OnQuery(transform); } _dv = Up; _isUp = true; Top = Situ + 0.1f; int value = GetComponent <MahjongItem>().Value; EventDispatch.Dispatch((int)GameEventId.FlagMahjong, new EventData(value)); }
private IEnumerator MoveTo(Vector3 moveTo, float time, DVoidNoParam callBack = null) { float val = 0; float bTime = Time.time; var fpos = transform.localPosition; var tpos = moveTo; while (val < time) { val = Time.time - bTime; float smoothval = val / time; transform.localPosition = Vector3.Lerp(fpos, tpos, smoothval); yield return(2); } if (callBack != null) { callBack(); } }
public void RotaTo(Vector3 to, float time, float delayTime = 0, DVoidNoParam callBack = null) { if (gameObject.activeInHierarchy) { if (_rotoToCor != null) { StopCoroutine(_rotoToCor); } _rotoToCor = StartCoroutine(RotoTo(to, time, delayTime, callBack)); } else { Quaternion tquat = Quaternion.Euler(to); transform.localRotation = tquat; if (callBack != null) { callBack(); } } }
private void Up() { Vector3 v3 = Target.localPosition; v3.y -= Speed; if (v3.y <= Top) { _dv = Nothing; v3.y = Top; if (_isUp) { _isUp = false; } else { _dv = Down; } } Target.localPosition = v3; }
public void RollDown() { if (_isUp) { _isUp = false; } else { _dv = Down; } EventDispatch.Dispatch((int)GameEventId.CleareFlagMahjong, new EventData()); MahjongIcon icon = GetComponent <MahjongIcon>(); if (null != icon) { icon.IsQuerying = false; EventDispatch.Dispatch((int)UIEventId.HideQueryHulistPnl); } }
private IEnumerator TimeUpdata(DVoidNoParam callBack = null) { while (_time >= 0) { yield return(new WaitForSeconds(1)); _time--; TimeNum.Num = _time; if (_time <= 3 && _time >= 1) { Facade.Instance <MusicManager>().Play("clock"); } if (_time == 0) { Facade.Instance <MusicManager>().Play("naozhong"); } } //TimeNum.gameObject.SetActive(false); if (callBack != null) { callBack(); } }
public virtual void SetShowInfo(TableData table, Texture[] defineArray) { gameObject.SetActive(true); if (RoomID != null) { RoomID.text = table.RoomInfo.RoomID + ""; } if (RoundImg != null) { RoundImg.sprite = table.RoomInfo.GameLoopType == EnGameLoopType.round ? JuImg : QuanImg; } if (Round != null) { Round.text = table.RoomInfo.CurrRound + "/" + table.RoomInfo.MaxRound; } if (TimeData != null) { TimeData.text = DateTime.Now.ToString("yyyy年MM月dd日 HH:mm:ss"); } foreach (OnRoudResultItem item in Items) { item.SetVisible = false; item.Chair = -1; } var seatList = new List <int>(); for (int i = 0; i < UtilData.CurrGamePalyerCnt; i++) { seatList.Add(i); } //根据胡牌玩家排序 seatList.Sort((a, b) => { bool isAHu = table.Result.HuSeat.Contains(a); bool isBHu = table.Result.HuSeat.Contains(b); if (isAHu && !isBHu) { return(-1); } if (!isAHu && isBHu) { return(1); } if (isAHu && isBHu) { int aScore = table.Result.HuGold[a]; int bScore = table.Result.HuGold[b]; if (aScore < bScore) { return(-1); } if (aScore > bScore) { return(1); } } return(0); }); UtilFunc.OutPutList(seatList, "游戏结束 玩家胡牌排序后"); if (BaoArea != null) { int bao = table.Result.bao; if (bao > 0) { GameObject baoItem = D2MahjongMng.Instance.GetMj(bao, EnD2MjType.Up, bao); baoItem.transform.parent = BaoArea; baoItem.transform.localPosition = Vector3.zero; baoItem.transform.localScale = Vector3.one; } } int huCnt = 1; for (int i = 0; i < seatList.Count; i++) { int seat = seatList[i]; Items[i].SetVisible = true; Items[i].Name = table.UserDatas[seat].name; Items[i].UserID = table.UserDatas[seat].id.ToString(); Items[i].StrHuInfo = table.Result.HuName[seat]; Items[i].IntHuScore = table.Result.HuGold[seat]; Items[i].IntGangScore = table.Result.GangGlod[seat]; Items[i].IntScore = table.Result.Gold[seat]; Items[i].IsHu = false; Items[i].SetPiaoScore = table.Result.PiaoGlod[seat]; Items[i].IsBanker = seat == table.BankerSeat; // 码分 Items[i].SetNiaoScore = table.Result.NiaoGold[seat]; //吃碰杠加入 Items[i].SetCpgCard(table.UserCpg[seat]); Items[i].SetHardCard(table.UserHardCard[seat].ToArray(), table.Laizi); //设置胡牌信息 if (huCnt++ <= table.Result.HuSeat.Count) { Items[i].IsHu = true; Items[i].SetHardCard(new[] { table.Result.HuCard }, table.Laizi); } Items[i].SortCardGroup(); Items[i].HuTypeValue = table.Result.UserHuType[seat]; int sex = table.UserDatas[seat].Sex; sex = sex >= 0 ? sex : 0; Items[i].SetHeadImg(table.UserDatas[seat].HeadImage, defineArray[sex % 2]); } if (UtilData.RoomType == EnRoomType.YuLe) { _startCall = () => { Hide(); EventDispatch.Dispatch((int)NetEventId.OnGameRestart, new EventData()); }; } bool isMeWin = table.Result.HuSeat.Contains(table.PlayerSeat); if (isMeWin) { if (Gril != null) { Gril.sprite = GrilWin; Facade.Instance <MusicManager>().Play("win"); Gril.SetNativeSize(); } if (Result != null) { Result.sprite = WinSpr; } } else { if (Gril != null) { Gril.sprite = GrilLost; Facade.Instance <MusicManager>().Play("loss"); Gril.SetNativeSize(); } if (Result != null) { Result.sprite = LostSpr; } } if (table.Result.HuType == MjRequestData.MJReqTypeLastCd) //流局 { if (Result != null) { Result.sprite = HeSpr; } } }
public void MoveToAction(Vector3 to, float time, DVoidNoParam callBack = null) { StartCoroutine(MoveTo(to, time, callBack)); }
public void Reset() { _dv = Nothing; Situ = Target.localPosition.y; }
public TimerItem(Coroutine cor, DVoidNoParam call) { this.cor = cor; this.call = call; }
public static int StartTimer(float time, DVoidNoParam callBack) { return(Instance.StartTimeLoop(time, callBack)); }
public void RotaTo(Vector3 from, Vector3 to, float time, float delayTime = 0, DVoidNoParam callBack = null) { //delaytime足够短,默认为直接亮出,不要从下向上翻的动画了 if (delayTime < 0.001) { transform.localRotation = Quaternion.Euler(to); return; } transform.localRotation = Quaternion.Euler(from); RotaTo(from, time, delayTime, callBack); }
protected IEnumerator TimeLoop(float time, DVoidNoParam callBack) { yield return(new WaitForSeconds(time)); callBack(); }