IEnumerator reloadScene() { yield return(new WaitForSeconds(2)); setLevel = GameObject.FindGameObjectWithTag("setLevel").GetComponent <SetLevel>(); SceneManager.LoadScene(0, LoadSceneMode.Single); }
private static void TurnOnElement(HttpRequestHead request, IHttpResponseDelegate response) { var status = new Status(); NameValueCollection parms = GetParameters(request); if (!parms.HasKeys() && parms["id"] != null && parms["time"] != null && parms["color"] != null) { HttpResponseHead headers = GetHeaders(0, HttpStatusCode.BadRequest.ToString()); response.OnResponse(headers, new BufferedProducer("")); return; } if (parms["color"].Length != 7 || !parms["color"].StartsWith("#")) { status.Message = "Invalid color. Must be Hex."; SerializeResponse(status, response); return; } Guid elementId = Guid.Empty; bool allElements = false; int seconds; if ("all".Equals(parms["id"])) { allElements = true; } else { Guid.TryParse(parms["id"], out elementId); } if (!int.TryParse(parms["time"], out seconds)) { status.Message = "Time must be numeric."; SerializeResponse(status, response); return; } Color elementColor = ColorTranslator.FromHtml(parms["color"]); //TODO the following logic for all does not properly deal with discrete color elements when turning all on //TODO they will not respond to turning on white if they are set up with a filter. //TODO enhance this to figure out what colors there are and turn them all on when we are turning all elements on. var effect = new SetLevel { TimeSpan = TimeSpan.FromSeconds(seconds), Color = elementColor, IntensityLevel = 1, TargetNodes = allElements ? VixenSystem.Nodes.GetRootNodes().ToArray() : new[] { VixenSystem.Nodes.GetElementNode(elementId) } }; Module.LiveSystemContext.Execute(new EffectNode(effect, TimeSpan.Zero)); status.Message = string.Format("{0} element(s) turned on for {1} seconds at 100% intensity.", allElements?"All":VixenSystem.Nodes.GetElementNode(elementId).Name, seconds); SerializeResponse(status, response); }
public override Command Combine(Command other) { SetLevel otherSetLevelCommand = other as SetLevel; if (otherSetLevelCommand != null) { double level = Math.Max(Level, otherSetLevelCommand.Level); return(new SetLevel(level)); } return(this); }
public void LevelUp() { if (burnLevel == SetLevel.Medium && state) { burnLevel = SetLevel.Height; return; } else if (burnLevel == SetLevel.Low && state) { burnLevel = SetLevel.Medium; return; } }
public void LevelDown() { if (frigeLevel == SetLevel.Medium && state) { frigeLevel = SetLevel.Low; return; } else if (frigeLevel == SetLevel.Height && state) { frigeLevel = SetLevel.Medium; return; } }
public void VolumeUp() { if (volume == SetLevel.Medium && state) { volume = SetLevel.Height; return; } else if (volume == SetLevel.Low && state) { volume = SetLevel.Medium; return; } }
/// <summary> /// Turns on a given element with a SetLevel effect given the parameters. If the seconds are zero, the /// effect will be given a duration of 30 days to simulate the element staying on. /// </summary> /// <param name="id"></param> /// <param name="seconds"></param> /// <param name="intensity"></param> /// <param name="color"></param> /// <returns></returns> public static Status TurnOnElement(Guid id, int seconds, double intensity, string color) { ElementNode node = VixenSystem.Nodes.GetElementNode(id); if (node == null) { throw new ArgumentException(@"Invalid element id.", "id"); } var status = new Status(); if (!string.IsNullOrEmpty(color) && (color.Length != 7 || !color.StartsWith("#"))) { throw new ArgumentException(@"Invalid color", color); } if (intensity > 100 || intensity < 0) { intensity = 100; } var effect = new SetLevel { TimeSpan = seconds > 0?TimeSpan.FromSeconds(seconds):TimeSpan.FromDays(30), IntensityLevel = intensity / 100, TargetNodes = new[] { node } }; //TODO check the passed color against the element to see if the element supports it if (!string.IsNullOrEmpty(color)) { Color elementColor = ColorTranslator.FromHtml(color); effect.Color = elementColor; } Module.LiveContext.Execute(new EffectNode(effect, TimeSpan.Zero)); if (seconds == 0) { status.Message = string.Format("{0} turned on at {1}% intensity.", node.Name, intensity); } else { status.Message = string.Format("{0} turned on for {1} seconds at {2}% intensity.", node.Name, seconds, intensity); } return(status); }
public void OnOff() { if (State) { state = false; volume = SetLevel.Low; return; } if (!State) { state = true; return; } }
public void Should_Set_Level_To_30() { TurnOnCommand cmd = new TurnOnCommand(Guid.NewGuid()) { Level = 70 }; var p = Domain.Device.TurnOn(eventMetadata, moqEventStore.Object, cmd); p.SetLevel(eventMetadata, p.AggregateGuid, 30, p.Version); var events = p.GetUncommittedEvents(); events.Count().ShouldEqual(2); Assert.IsInstanceOf <SetLevel>(events.Last()); SetLevel setLevel = events.Last() as SetLevel; setLevel.Level.ShouldEqual(30); }
public void Start() { answerAn = GetComponentInChildren <AnswerAnimController>(); GameObject ui = GameObject.FindWithTag("UI"); uiSetLevel = ui.GetComponent <SetLevel>(); uiSetSceneColor = ui.GetComponent <SetSceneColor>(); exercB = GetComponent <ExerciseBlock>(); sound = GameObject.FindWithTag("Sound").GetComponent <soundController>(); level = GameObject.FindWithTag("DataController") .GetComponent <DataController>().currentLevel; StartLevel(); }
void SetupSelfInfo() { if (!SelfPlayerLevelData.HasLocalData(StaticData.LevelID)) { cur_rank = 0; text_rank.text = "-"; image_rank.sprite = null; image_rank.color = Color.clear; text_record.text = "0"; } else { cur_rank = SelfPlayerLevelData.CurRank; text_rank.text = cur_rank.ToString(); int _accuracy = SetLevel.setLevel(SelfPlayerLevelData.CurAccuracy); image_rank.sprite = sp_ranks[_accuracy]; image_rank.color = Color.white; text_record.text = SelfPlayerLevelData.MaxScore.ToString(); } }
private static IEffectModuleInstance CreateEffect(ElementNode node, int seconds, double intensity, string color) { if (!string.IsNullOrEmpty(color) && (color.Length != 7 || !color.StartsWith("#"))) { throw new ArgumentException(@"Invalid color", color); } var effect = new SetLevel { TimeSpan = seconds > 0 ? TimeSpan.FromSeconds(seconds) : TimeSpan.FromDays(30), IntensityLevel = intensity / 100, TargetNodes = new[] { node } }; //TODO check the passed color against the element to see if the element supports it if (!string.IsNullOrEmpty(color)) { Color elementColor = ColorTranslator.FromHtml(color); effect.Color = elementColor; } return(effect); }
public PlayerInfoPanel Setup(RankObject rankObject, bool setScoreZero = false) { if (string.IsNullOrEmpty(rankObject.user.avatar)) { rankObject.user.avatar = "NoAvatar"; } string avatarUrl = ""; rankObjectDebug = rankObject; isSelf = rankObject.uid == SelfPlayerData.Uuid; var sprite = Resources.Load <Sprite> ("UI/_Avatars/" + rankObject.user.avatar); if (isSelf && string.IsNullOrEmpty(SelfPlayerData.Uuid) == false) { SelfPlayerLevelData.Instance.changeNameEvent.AddListener(ChangeMyNameOrAvatar); ChangeMyNameOrAvatar(); //var sprite = Resources.Load<Sprite>("UI/_Avatars/" + SelfPlayerData.AvatarUrl); //if (sprite == null) //{ // LogManager.LogWarning("没有图片 Resources/UI/_Avatars/" , SelfPlayerData.AvatarUrl); // SelfPlayerData.AvatarUrl = "NoAvatar"; // sprite = Resources.Load<Sprite>("UI/_Avatars/" + SelfPlayerData.AvatarUrl); //} transform.Find("Image_gear").GetComponent <Image> ().color = new Color32(255, 221, 142, 255); //image_avatar.sprite = sprite; avatarUrl = SelfPlayerData.AvatarUrl; //AsyncImageDownload.GetInstance().SetAsyncImage(SelfPlayerData.AvatarUrl, image_avatar, sprite); image_base.sprite = sp_player; } else { SelfPlayerLevelData.Instance.changeNameEvent.RemoveListener(ChangeMyNameOrAvatar); text_name.text = rankObject.user.nickname; //if (sprite == null) //{ // LogManager.LogWarning("没有图片 Resources/UI/_Avatars/" , rankObject.user.avatar); // sprite = Resources.Load<Sprite>("UI/_Avatars/NoAvatar"); //} transform.Find("Image_gear").GetComponent <Image> ().color = new Color32(255, 255, 255, 255); //image_avatar.sprite = sprite; avatarUrl = rankObject.user.avatar; //AsyncImageDownload.GetInstance().SetAsyncImage(rankObject.user.avatar, image_avatar, sprite); image_base.sprite = sp_default; } //if (avatarUrl.IndexOf("http:") != -1) //{ // AsyncImageDownload.GetInstance().SetAsyncImage(avatarUrl, image_avatar); //} //else if(avatarUrl.IndexOf("Avatar") != -1) //{ SetAvatar(image_avatar, rankObject.uid); userCountry.sprite = GetCountryByIndex(rankObject.user.country); //} text_rank.text = rankObject.rank.ToString(); int grade = SetLevel.setLevel(rankObject.accuracy); LogManager.Log("玩家获得的级别序号:", grade); _score = rankObject.score; image_accuracy.sprite = sp_ranks[grade]; text_score.text = setScoreZero ? "0" : _score.ToString(); gameObject.SetActive(true); if (but_Video != null) { if (rankObjectDebug.rank != 1 || StaticData.LevelID % 4 == 0) { but_Video.gameObject.SetActive(false); but_Voice.transform.localPosition = new Vector2(but_Voice.transform.localPosition.x, 0); } else { but_Video.gameObject.SetActive(true); but_Voice.transform.localPosition = new Vector2(but_Voice.transform.localPosition.x, -48); } } return(this); }
public void GameFinish() { m_Status = GameStatus.Finish; AudioController.Play("applause"); if (m_WrongNum == 0) { AudioController.Play("combo_perfect"); } if (m_Life > 0) { AnalysisManager.Instance.OnEvent("100002", null, StaticData.LevelID.ToString(), "完成游戏"); AnalysisManager.Instance.OnEvent("100001", null, StaticData.LevelID.ToString(), m_Life.ToString()); AnalysisManager.Instance.OnLevelCompleted(StaticData.LevelID.ToString()); } else { AnalysisManager.Instance.OnEvent("100002", null, StaticData.LevelID.ToString(), "完成游戏"); AnalysisManager.Instance.OnEvent("100001", null, StaticData.LevelID.ToString(), "空血通关"); AnalysisManager.Instance.OnLevelFailed(StaticData.LevelID.ToString(), "没血通关"); } // 记录成绩 SelfPlayerLevelData.TempRankIncrement = SelfPlayerLevelData.CurRank; Debug.LogWarning(" 记录成绩 = " + SelfPlayerLevelData.TempRankIncrement); Debug.Log("<======记录舞蹈数据 boss战舞蹈数据为空 ======>"); // 打开UI if (CorePlayData.BossLife > 0) { m_ProcessData = null; SelfPlayerRoleTitleData.Instance.UpdateRoleTitleCount(50002); } else { SelfPlayerRoleTitleData.Instance.UpdateRoleTitleCount(50001); PlayerOperationData operData = new PlayerOperationData(); operData.wholeScore = m_Score; operData.clickAccuracy = (float)m_CorrectNum / m_AllWordNum; operData.clickNumber = m_AllWordNum; operData.clickScore = m_Score - (int)(m_SumVoiceScore * CorePlaySettings.Instance.m_VoiceRightPoint); operData.wrongNumber = m_WrongNum; operData.rightNumber = m_CorrectNum; operData.m_ReadingData = CorePlayData.PlayerReadingData; //临时测试上传操作过程数据 m_ProcessData = operData.GetJson(); } SaveDataUtils.Save <SelfPlayerRoleTitleData>(); DancingWordAPI.Instance.UpDateServerRoleTitleInfo(SelfPlayerRoleTitleData.RoleTitleList); SaveResultToLocal(m_Life); int grade = SetLevel.setLevel(SelfPlayerLevelData.CurAccuracy); SelfPlayerData.Instance.AddExpAndSaveToLocal(grade); // 关录音 XunFeiSRManager.Instance.StopListen(); MicManager.Instance.StopRecord(); LoginRpcProxy.getInstance().SaveLevelVoices(MicManager.Instance.voiceDic); PageManager.Instance.CurrentPage.GetComponent <CorePlayPage>().HidePauseButton(); if (CorePlayData.BossLife > 0) { PageManager.Instance.CurrentPage.GetNode <WinNode>().Open(); } else { HttpHandler.UploadScore(ServerDataCallback, true); m_AlreadyRuning = false; LoadStage(); } }
static void Init() { SetLevel window = (SetLevel)EditorWindow.GetWindow(typeof(SetLevel)); window.Show(); }