static EventBase GetFakeEvent() { var selector = Faker.NumberFaker.Number(0, 5); switch (selector) { case 0: var e = new DoorEvent { Eventno = count++, EventType = DoorEventEventType.DoorEvent, Doors = new DoorsSchema { Event = count++, Left = new Doorpos { Count = Faker.NumberFaker.Number(0, 65000), Open = Faker.BooleanFaker.Boolean() }, Right = new Doorpos { Count = Faker.NumberFaker.Number(0, 65000), Open = Faker.BooleanFaker.Boolean() } } }; return(e); case 1: var le = new LightEvent { Eventno = count++, EventType = LightEventEventType.LightEvent, Lights = new LightsSchema { Event = Faker.NumberFaker.Number(0, 11), Frontpass = Faker.BooleanFaker.Boolean(), Rearpass = Faker.BooleanFaker.Boolean(), Left = new Lightpos { Count = Faker.NumberFaker.Number(0, 65000), Lit = Faker.BooleanFaker.Boolean() }, Right = new Lightpos { Count = Faker.NumberFaker.Number(0, 65000), Lit = Faker.BooleanFaker.Boolean() }, Rear = new Lightpos { Count = Faker.NumberFaker.Number(0, 65000), Lit = Faker.BooleanFaker.Boolean() } } }; return(le); case 2: var re = new RelocatedEvent { EventType = RelocatedEventEventType.RelocatedEvent, Location = GetFakeLocation() }; return(re); case 3: var pe = new PowerEvent { EventType = PowerEventEventType.PowerEvent, Msg = Faker.TextFaker.Sentence() }; return(pe); case 4: var ce = new CommEvent { EventType = CommEventEventType.CommEventSuccess, Conncount = count++, Humidity = Faker.NumberFaker.Number(0, 100), Tempf = Faker.NumberFaker.Number(0, 100), Msgnum = count, Msg = Faker.TextFaker.Sentence() }; return(ce); case 5: var cee = new CommEvent { EventType = CommEventEventType.CommEventError, Conncount = count++, Humidity = Faker.NumberFaker.Number(0, 100), Tempf = Faker.NumberFaker.Number(0, 100), Msgnum = count, Msg = Faker.TextFaker.Sentence() }; return(cee); default: return(null); } }
public extern void RemoveCommandBuffer(LightEvent evt, CommandBuffer buffer);
public extern CommandBuffer[] GetCommandBuffers(LightEvent evt);
public extern void RemoveCommandBuffers(LightEvent evt);
public ProfileManager(string name, string internal_name, string[] process_names, Type settings, Type control, LightEvent game_event) { Name = name; InternalName = internal_name; ProcessNames = process_names; Icon = null; Control = null; ControlType = control; SettingsType = settings; Settings = (ProfileSettings)Activator.CreateInstance(settings); game_event.Profile = this; Event = game_event; Profiles = new Dictionary <string, ProfileSettings>(); EffectScripts = new Dictionary <string, dynamic>(); if (game_event._game_state != null) { ParameterLookup = Utils.GameStateUtils.ReflectGameStateParameters(game_event._game_state.GetType()); } else { ParameterLookup = new Dictionary <string, Tuple <Type, Type> >(); } if (AvailableLayers == null) { AvailableLayers = new HashSet <LayerType>(); } AvailableLayers.Add(LayerType.Default); AvailableLayers.Add(LayerType.Solid); AvailableLayers.Add(LayerType.SolidFilled); AvailableLayers.Add(LayerType.Gradient); AvailableLayers.Add(LayerType.GradientFill); AvailableLayers.Add(LayerType.Breathing); AvailableLayers.Add(LayerType.Blinking); AvailableLayers.Add(LayerType.Image); AvailableLayers.Add(LayerType.Percent); AvailableLayers.Add(LayerType.PercentGradient); AvailableLayers.Add(LayerType.Interactive); AvailableLayers.Add(LayerType.ShortcutAssistant); AvailableLayers.Add(LayerType.Equalizer); AvailableLayers.Add(LayerType.Ambilight); AvailableLayers.Add(LayerType.LockColor); LoadProfiles(); }
private void ScheduleLights() { Debug.Print("Scheduling lights: " + m_services.Now.ToString(m_config.DATETIME_FORMAT)); bool isDstToday = m_config.IsDstInEffect(m_services.Now); if (isDstToday && !m_isDst) { // Spring a head m_services.SetLocalTime(m_services.Now + new TimeSpan(1, 0, 0)); Debug.Print("DST starting. Time now: " + m_services.Now.ToString(m_config.DATETIME_FORMAT)); m_isDst = isDstToday; } else if (m_isDst && !isDstToday) { // Fall back m_services.SetLocalTime(m_services.Now - new TimeSpan(1, 0, 0)); Debug.Print("DST over. Time now: " + m_services.Now.ToString(m_config.DATETIME_FORMAT)); m_isDst = isDstToday; } lock (m_lightTimesLock) { m_lightTimes = new LightTimes(m_services.Now, m_config); } // Get an order list of events for the day ArrayList les = LightEventsForDate(m_lightTimes); // Iterate over the list looking for previous event and next event based on current time int prevIndex = -1; for (int i = 0; i < les.Count; i++) { LightEvent le = (LightEvent)les[i]; if (le.DT < m_services.Now) prevIndex = i; else break; } // Turn the light on if the previous event was an on event if (prevIndex > -1) { LightEvent prev = (LightEvent)les[prevIndex]; if (prev.Type == LightEventType.Scheduled_On || prev.Type == LightEventType.Sunset_On) { Debug.Print("Turning light ON due to missed event"); m_relay.TurnOn(); } } // Iterate over the remaining events adding each to the event queue if (prevIndex + 1 < les.Count) { for (int i = prevIndex + 1; i < les.Count; i++) { LightEvent le = (LightEvent)les[i]; Debug.Print("Enqueing LE: " + le.ToString(m_config.DATETIME_FORMAT)); m_events.Enqueue(le); } } // Schedule the event to schedule tomorrows events LightEvent scheduleEvent = new LightEvent(m_services.Now.Date + new TimeSpan(1, 0, 0, 0), LightEventType.Tomorrow); Debug.Print("Enqueing LE: " + scheduleEvent.ToString(m_config.DATETIME_FORMAT)); m_events.Enqueue(scheduleEvent); }
private void OnRedOn(LightEvent obj) { RedLight.gameObject.SetActive(true); }
private void OnRedOff(LightEvent obj) { RedLight.gameObject.SetActive(false); }
public CommandBuffer[] GetCommandBuffers(LightEvent evt);
public ProfileManager(string name, string internal_name, string[] process_names, ProfileSettings settings, LightEvent game_event) { Name = name; InternalName = internal_name; ProcessNames = process_names; Icon = null; Control = null; Settings = settings; Event = game_event; Profiles = new Dictionary <string, ProfileSettings>(); EffectScripts = new Dictionary <string, dynamic>(); LoadProfiles(); }
public CommandBuffer[] GetCommandBuffers(LightEvent evt) { throw new NotImplementedException("なにこれ"); }
public void RemoveCommandBuffers(LightEvent evt) { throw new NotImplementedException("なにこれ"); }
public void AddCommandBuffer(LightEvent evt, CommandBuffer buffer) { throw new NotImplementedException("なにこれ"); }
public void AddCommandBuffer(LightEvent evt, CommandBuffer buffer) { this.AddCommandBuffer(evt, buffer, ShadowMapPass.All); }
private void OnAmberOn(LightEvent obj) { AmberLight.gameObject.SetActive(true); }
private void CommandBufferGUI() { if (targets.Length != 1) { return; } Light light = target as Light; if (light == null) { return; } int commandBufferCount = light.commandBufferCount; if (commandBufferCount != 0) { commandBufferShown = GUILayout.Toggle(commandBufferShown, new GUIContent(commandBufferCount + " command buffers"), EditorStyles.foldout, new GUILayoutOption[0]); if (commandBufferShown) { EditorGUI.indentLevel++; LightEvent[] array = (LightEvent[])Enum.GetValues(typeof(LightEvent)); for (int i = 0; i < array.Length; i++) { LightEvent lightEvent = array[i]; CommandBuffer[] commandBuffers = light.GetCommandBuffers(lightEvent); CommandBuffer[] array2 = commandBuffers; for (int j = 0; j < array2.Length; j++) { CommandBuffer commandBuffer = array2[j]; using (new GUILayout.HorizontalScope(new GUILayoutOption[0])) { Rect rect = GUILayoutUtility.GetRect(GUIContent.none, EditorStyles.miniLabel); rect.xMin += EditorGUI.indentLevel; Rect removeButtonRect = GetRemoveButtonRect(rect); rect.xMax = removeButtonRect.x; GUI.Label(rect, string.Format("{0}: {1} ({2})", lightEvent, commandBuffer.name, EditorUtility.FormatBytes(commandBuffer.sizeInBytes)), EditorStyles.miniLabel); if (GUI.Button(removeButtonRect, IconRemove, InvisibleButton)) { light.RemoveCommandBuffer(lightEvent, commandBuffer); SceneView.RepaintAll(); repaintAll.Invoke(null, null); GUIUtility.ExitGUI(); } } } } using (new GUILayout.HorizontalScope(new GUILayoutOption[0])) { GUILayout.FlexibleSpace(); if (GUILayout.Button("Remove all", EditorStyles.miniButton, new GUILayoutOption[0])) { light.RemoveAllCommandBuffers(); SceneView.RepaintAll(); repaintAll.Invoke(null, null); } } EditorGUI.indentLevel--; } } }
private void OnAmberOff(LightEvent obj) { AmberLight.gameObject.SetActive(false); }
public extern void AddCommandBuffer(LightEvent evt, CommandBuffer buffer);
private void OnGreenOn(LightEvent obj) { GreenLight.gameObject.SetActive(true); }
private void OnGreenOff(LightEvent obj) { GreenLight.gameObject.SetActive(false); }
public ProfileManager(string name, string internal_name, string process_name, Type settings, Type control, LightEvent game_event) : this(name, internal_name, new string[] { process_name }, settings, control, game_event) { }
public void AddCommandBuffer(LightEvent evt, CommandBuffer buffer) { }
public void RemoveCommandBuffer(LightEvent evt, CommandBuffer buffer) { }
public void RemoveCommandBuffers(LightEvent evt) { }
public async Task SaveAsLastLightEvent(LightEvent lightEvent) { await Task.Run(() => _cache.Set("GetLastEvent", lightEvent)); await Task.Run(() => _cache.Set($"GetLastEvent.{lightEvent.Light.Id}", lightEvent)); }
public List <CommandBuffer> GetCommandBuffers(LightEvent evt) { return(null); }
public override int Compare(LightEvent x, LightEvent y) { return(base.Compare(x, y) == 0 ? CompareSatState(x.State, y.State) : base.Compare(x, y)); }
void RayCastRange(Range range) { float curRange = range.minimum; List <Vector3> vertex = new List <Vector3>(); vertex.Add(transform.position); do { curRange += perDegreee; float curRad = curRange * Mathf.Deg2Rad; Vector2 direction = new Vector2(Mathf.Cos(curRad), Mathf.Sin(curRad)); RaycastHit2D[] ress = Physics2D.RaycastAll(transform.position, direction); bool trueHitFlag = false; for (int i = 0; i < ress.Length; i++) { RaycastHit2D res = ress[i]; if (res.collider.tag == "Player") { res.collider.GetComponent <LightShadowForm>().currameHit = true; continue; } if (res.collider != null) { trueHitFlag = true; vertex.Add(res.point - res.normal * 0.2f); LightEvent target = res.collider.GetComponent <LightEvent>(); if (target) { target.currameHit = true; } } break; } if (!trueHitFlag) { vertex.Add(transform.position + 100 * direction.Vec2ToVec3()); } }while (curRange < range.maxmum); if (vertex.Count > 3) { int[] triangles = new int[3 * (vertex.Count - 2)]; Vector2[] uv = new Vector2[vertex.Count]; for (int i = 0; i < uv.Length; i++) { uv[i] = new Vector2(0, 0); } for (int i = 0; 3 * i + 2 < triangles.Length; i++) { triangles[3 * i] = i + 1; triangles[3 * i + 1] = 0; triangles[3 * i + 2] = i + 2; } Debug.Log(vertex.Count); mesh.vertices = vertex.ToArray(); mesh.triangles = triangles; mesh.uv = uv; //Graphics.DrawMesh(mesh, Matrix4x4.identity, lightMat, 0, lightCamera); meshFilter.mesh = mesh; } }
public extern void AddCommandBuffer(LightEvent evt, CommandBuffer buffer, ShadowMapPass shadowPassMask);