//发送列表请求 or 重置大转盘 void SendListMsg(RequestType requestType) { ComLoading.Open(); HttpTask task = new HttpTask(ThreadType.MainThread, TaskResponse.Default_Response); task.AppendCommonParam(requestType, new BigWheelListParam(Core.Data.playerManager.PlayerID)); task.ErrorOccured = (BaseHttpRequest request, string error) => { ComLoading.Close(); SQYAlertViewMove.CreateAlertViewMove(error); }; task.afterCompleted = (BaseHttpRequest requset, BaseResponse response) => { ComLoading.Close(); if (response.status != BaseResponse.ERROR) { wheels.Clear(); wheels.AddRange(wheels_object.ToArray()); BigWheelListResponse res = response as BigWheelListResponse; if (res.data != null && res.data.awardList.Count > 0) { ShowBigWheelList(res.data.awardList); flushCount = res.data.flushCount; totalCount = res.data.totalCount; ShowResetButton(); ShowUseButton(res.data.needStone); if (wheels.Count > 0) { foreach (BigWheelReward rewardObj in wheels) { if (rewardObj.isSelected) { rewardObj.isSelected = false; } } WheelIndex = 0; LastSelected = wheels[0]; LastSelected.isSelected = true; } } else { SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getString(9118)); } } else { SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getNetworkErrorString(response.errorCode)); } }; task.DispatchToRealHandler(); }
void Update() { if (!isRUN) { return; } if (TimeCount < TimeInterval) { TimeCount += Time.deltaTime; return; } TimeCount = 0; if (WheelIndex >= wheels.Count) { WheelIndex = 0; } if (UpOrDown) { if (TimeInterval > 0.04f) { TimeInterval -= 0.02f; TimeInterval = float.Parse(TimeInterval.ToString("f2")); MaxSpeedTime = Time.time; } else { if (Time.time - MaxSpeedTime > 1f) { //开始降速 isSTOP = true; int downCount = (int)((0.3f - 0.04f) / 0.02f); int wheelsCount = wheels.Count; STOPIndex = Mathf.Abs(NeedID - downCount) % wheelsCount; if (STOPIndex != 0) { STOPIndex = wheelsCount - Mathf.Abs(NeedID - downCount) % wheelsCount; } //Debug.Log("downCount="+downCount.ToString()+" NeedID="+NeedID.ToString()+" STOPIndex="+STOPIndex.ToString()); } } } else { TimeInterval += 0.02f; if (TimeInterval >= 0.3f) { isRUN = false; UpOrDown = true; Invoke("OnBigWheelAnimationFinished", 0.5f); } TimeInterval = float.Parse(TimeInterval.ToString("f2")); //Debug.Log("-----TimeInterval=------------"+TimeInterval.ToString() + " WheelIndex"+WheelIndex.ToString() ) ; } if (WheelIndex < wheels.Count) { wheels[WheelIndex].isSelected = true; if (LastSelected != null) { LastSelected.isSelected = false; } LastSelected = wheels[WheelIndex]; } if (isSTOP) { if (WheelIndex == STOPIndex) { UpOrDown = false; isSTOP = false; } } WheelIndex++; }