public Material GetColorMaterial(LSColorType type) { string materialName; switch (type) { case LSColorType.DEFAULT: materialName = LSConstant.ColorItem_Default; break; case LSColorType.GREEN: materialName = LSConstant.ColorItem_Green; break; case LSColorType.RED: materialName = LSConstant.ColorItem_Red; break; case LSColorType.YELLOW: materialName = LSConstant.ColorItem_Yellow; break; default: YxDebug.LogError("Color is not exist, name is " + type.ToString()); materialName = null; break; } return(App.GetGameManager <LswcGamemanager>().ResourseManager.GetMaterial(materialName)); }
protected override void InitOther() { for (int i = 0; i < Items.Count; i++) { LSColorItem item = (LSColorItem)Items[i]; LSColorType type = App.GetGameData <LswcGameData>().Colors[i]; item.SetColorType(type); item.name = item.CurColor.ToString(); } }
public void SetColorType(LSColorType type) { CurColor = type; var curRender = GetRender; if (curRender == null) { return; } curRender.material = App.GetGameData <LswcGameData>().GetColorMaterial(CurColor); }
/// <summary> /// 查找满足条件的第一个颜色区域的索引,用于确定 /// </summary> /// <param name="color"></param> /// <returns></returns> private int FindColorIndex(LSColorType color) { for (int i = 0; i < Colors.Length; i++) { if (Colors[i] == color) { return(i); } } YxDebug.LogError("Such type is not exist " + color.ToString()); return(-1); }
private int GetLastIndex(LSColorType type) { int index = Items.FindLastIndex(delegate(LSItemBase Obj) { LSColorItem item = (LSColorItem)Obj; return(item.IsRightColor(type)); }); if (index < 0 || index > Items.Count) { //Debug.LogError("Not have such item,type is "+type+" index is "+ index); index = -1; } return(index); }
/// <summary> /// 获得最新的历史记录的详细信息 /// </summary> /// <returns></returns> public LS_Detail_Result SetDetialResult(int TurnTablePosition, float Time, int multiple, int addGold) { //Debug.LogError("本局结果是"); LSResult res = GetHistoryResult(LSConstant.History_Lenth - 1); LSColorType resultColor = Colors[TurnTablePosition]; LSAnimalType resultAnimal = (LSAnimalType)AnimalStartPos[TurnTablePosition]; LastResult.Banker = res.Banker; LastResult.TurnTablePosition = TurnTablePosition; LastResult.BetIndex = res.BetIndex; LastResult.Reward = res.ResultType; //LastResult.Reward = LSRewardType.LIGHTING; LastResult.Cor = (LSColorType)(res.BetIndex % 3); LastResult.Ani = (LSAnimalType)(res.BetIndex / 3); YxDebug.Log("通过历史数据解析的结果为:动物 " + LastResult.Ani + " 颜色是:" + LastResult.Cor); LastResult.Cor = resultColor; LastResult.Ani = resultAnimal; LastResult.Multiple = multiple; //LastResult.Multiple = 3; _totalGold += addGold; LastResult.WinBets = addGold; YxDebug.Log("结果类型:" + LastResult.Reward); YxDebug.Log("指针:" + LastResult.TurnTablePosition); YxDebug.Log("动物:" + LastResult.Ani); YxDebug.Log("颜色: " + LastResult.Cor); YxDebug.Log("庄和闲: " + LastResult.Banker); YxDebug.Log("增加金币" + addGold); var gameMgr = App.GetGameManager <LswcGamemanager>(); LastResult.ToColor = gameMgr.ColorItemControl.GetCheckColorItem(LastResult.TurnTablePosition) as LSColorItem; if (LastResult.ToColor != null) { LastResult.ToAngle = LastResult.ToColor.transform.localEulerAngles; } LastResult.ToAnimal = gameMgr.AnimalItemCtrl.GetCheckColorItem((LastResult.TurnTablePosition - AnimalRandomSeed + LSConstant.Num_AnimalItemNumber) % 24) as LSAnimalItem; LastResult.lastResultVoice = GetResultVoice(); return(LastResult); }
private IEnumerator TweenColor() { for (int i = 0; i < Items.Count; i++) { LSColorItem item = (LSColorItem)Items[i]; if (item) { item.SetColorType(LSColorType.DEFAULT); } yield return(new WaitForSeconds(_tweenFrame * Time.deltaTime)); } for (int i = 0; i < Items.Count; i++) { LSColorItem item = (LSColorItem)Items[i]; LSColorType type = App.GetGameData <LswcGameData>().Colors[i]; item.SetColorType(type); yield return(new WaitForSeconds(_tweenFrame * Time.deltaTime)); } }
public bool IsRightColor(LSColorType type) { return(type == CurColor); }