public Update(UpdateActions action, string user, string resource, string state, DateTime date) : this() { this.Action = action; this.User = user; this.Resource = resource; this.State = state; this.Date = date; }
/// <summary> /// Constructor to get the connection /// </summary> /// <param name="js"></param> /// <param name="setup"></param> public StoreSet(IJSObjectReference js, Settings setup) { if (Settings.EnableDebug) { Console.WriteLine($"StoreSet constructor for : {Utils.GetGenericTypeName(this.GetType())}"); } DeleteActions = new(js, setup); InsertActions = new(js, setup); UpdateActions = new(js, setup); SelectActions = new(js, setup); TableActions = new(js, setup); }
public override void ApplyChangedProperties(OpenGL gl) { if (!ProgramIsBound) { throw new Exception("This method cannot be called outside a program. Consider using this inside RenderAll(OpenGL, Action)."); } foreach (var act in UpdateActions) { act.Invoke(gl); } UpdateActions.Clear(); }
protected override void Handle(UpdateActions args) { App.QueueOnMainThread(() => { foreach (var action in args.Removed) { Actions.Remove(action.Name); } foreach (var action in args.Added) { Actions.Add(action.Name); } }); }
/// <summary> /// Add or delete QnA Pairs and / or URLs to an existing knowledge base. /// </summary> /// <param name="id">Knowledge base identity.</param> /// <param name="add">Data to be added to the knowledge base.</param> /// <param name="delete">Data to be deleted from the knowledge base.</param> /// <exception cref="QnaMakerError" /> /// <returns> /// <see cref="UpdateKnowledgeBaseResponse" /> /// </returns> public async Task <UpdateKnowledgeBaseResponse> UpdateKownledgeBase(Guid id, UpdateActions add = null, UpdateActions delete = null) { if (add == null) { add = new UpdateActions(); } if (delete == null) { delete = new UpdateActions(); } return(await UpdateKownledgeBase(new UpdateKnowledgeBaseRequest { KnowledgeBaseId = id, Add = add, Delete = delete })); }
public int Update(string value, UpdateActions action) { int previousResult; int currentValue; switch (action) { case UpdateActions.UpdatePrevious: previousResult = int.Parse(value); return(previousResult); case UpdateActions.UpdateCurrent: currentValue = int.Parse(value); return(currentValue); default: return(0); } }
protected virtual void Handle(UpdateActions message) { }
public void Init() { mr = GetComponent <MeshRenderer>(); ChangeBrightness(sector.brightness); if (sector.specialType == 0 && sector.tag == 0) { enabled = false; return; } if (sector.specialType == 0) { return; } switch (sector.specialType) { default: Debug.Log("Unknown sector type: " + sector.specialType); break; case 1: //blink random { float random = UnityEngine.Random.Range(.2f, .8f); float time = 0; bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[5] { time, flip, original, neighbor, random }; } UpdateActions.Add(new Action(() => { float time = (float)parameters[0]; time += Time.deltaTime; if (time >= (float)parameters[4]) { bool flip = (bool)parameters[1]; time = 0; flip = !flip; ChangeBrightness(flip ? (float)parameters[2] : (float)parameters[3]); parameters[1] = flip; parameters[4] = UnityEngine.Random.Range(.2f, .8f); } parameters[0] = time; })); break; case 2: //fast strobe case 4: { float time = UnityEngine.Random.Range(0, .5f); bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[4] { time, flip, original, neighbor }; } UpdateActions.Add(new Action(() => { float time = (float)parameters[0]; time += Time.deltaTime; bool flip = (bool)parameters[1]; if ((flip && time >= .15f) || time > .5f) { time = 0; flip = !flip; ChangeBrightness(flip ? (float)parameters[2] : (float)parameters[3]); parameters[1] = flip; } parameters[0] = time; })); break; case 3: //slow strobe { float time = UnityEngine.Random.Range(0, 1f); bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[4] { time, flip, original, neighbor }; } UpdateActions.Add(new Action(() => { float time = (float)parameters[0]; time += Time.deltaTime; bool flip = (bool)parameters[1]; if ((flip && time > .15f) || time >= 1f) { time = 0; flip = !flip; ChangeBrightness(flip ? (float)parameters[2] : (float)parameters[3]); parameters[1] = flip; } parameters[0] = time; })); break; //damage sectors, handled by PlayerThing case 5: case 7: case 16: case 11: break; case 8: //oscillates UpdateActions.Add(new Action(() => { ChangeBrightness(Mathf.Sin(Time.time * 4) * .25f + .75f); })); break; case 9: //secret area PlayerInfo.Instance.unfoundSecrets.Add(sector); break; case 12: //fast strobe, synchronized { bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[3] { original, neighbor, flip }; } UpdateActions.Add(new Action(() => { bool flip = Time.time % .65f > .5f; if (flip != (bool)parameters[2]) { parameters[2] = flip; ChangeBrightness(flip ? (float)parameters[0] : (float)parameters[1]); } })); break; case 13: //slow strobe, synchronized { bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[3] { original, neighbor, flip }; } UpdateActions.Add(new Action(() => { bool flip = Time.time % 1.15f > 1f; if (flip != (bool)parameters[2]) { parameters[2] = flip; ChangeBrightness(flip ? (float)parameters[0] : (float)parameters[1]); } })); break; case 17: //flicker randomly { float random = UnityEngine.Random.Range(.05f, .15f); float time = 0; bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[5] { time, flip, original, neighbor, random }; } UpdateActions.Add(new Action(() => { float time = (float)parameters[0]; time += Time.deltaTime; if (time >= (float)parameters[4]) { bool flip = (bool)parameters[1]; time = 0; flip = !flip; ChangeBrightness(flip ? (float)parameters[2] : (float)parameters[3]); parameters[1] = flip; parameters[4] = UnityEngine.Random.Range(.05f, .15f); } parameters[0] = time; })); break; } }
public void Init() { mr = GetComponent <MeshRenderer>(); if (sector.specialType == 0 && sector.tag == 0) { enabled = false; return; } //sector types are only applied on floors (which in turn can control the ceiling) if (sector.floorObject == gameObject && sector.specialType > 0) { switch (sector.specialType) { case 1: //blink random { float random = UnityEngine.Random.Range(.2f, .8f); float time = 0; bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[5] { time, flip, original, neighbor, random }; } UpdateActions.Add(new Action(() => { float time = (float)parameters[0]; time += Time.deltaTime; if (time >= (float)parameters[4]) { bool flip = (bool)parameters[1]; time = 0; flip = !flip; ChangeBrightness(flip ? (float)parameters[2] : (float)parameters[3]); parameters[1] = flip; parameters[4] = UnityEngine.Random.Range(.2f, .8f); } parameters[0] = time; })); break; case 17: //flicker randomly { float random = UnityEngine.Random.Range(.05f, .15f); float time = 0; bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[5] { time, flip, original, neighbor, random }; } UpdateActions.Add(new Action(() => { float time = (float)parameters[0]; time += Time.deltaTime; if (time >= (float)parameters[4]) { bool flip = (bool)parameters[1]; time = 0; flip = !flip; ChangeBrightness(flip ? (float)parameters[2] : (float)parameters[3]); parameters[1] = flip; parameters[4] = UnityEngine.Random.Range(.05f, .15f); } parameters[0] = time; })); break; case 8: //oscillates UpdateActions.Add(new Action(() => { ChangeBrightness(Mathf.Sin(Time.time * 4) * .25f + .75f); })); break; case 2: //blink 0.5second { float time = UnityEngine.Random.Range(0, .5f); bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[4] { time, flip, original, neighbor }; } UpdateActions.Add(new Action(() => { float time = (float)parameters[0]; time += Time.deltaTime; if (time >= .5f) { bool flip = (bool)parameters[1]; time = 0; flip = !flip; ChangeBrightness(flip ? (float)parameters[2] : (float)parameters[3]); parameters[1] = flip; } parameters[0] = time; })); break; case 12: //blink 0.5second synchronized { bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[3] { original, neighbor, flip }; } UpdateActions.Add(new Action(() => { bool flip = Time.time % 1f > .5f; if (flip != (bool)parameters[2]) { parameters[2] = flip; ChangeBrightness(flip ? (float)parameters[0] : (float)parameters[1]); } })); break; case 3: //blink 1.0second { float time = UnityEngine.Random.Range(0, 1f); bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[4] { time, flip, original, neighbor }; } UpdateActions.Add(new Action(() => { float time = (float)parameters[0]; time += Time.deltaTime; if (time >= 1f) { bool flip = (bool)parameters[1]; time = 0; flip = !flip; ChangeBrightness(flip ? (float)parameters[2] : (float)parameters[3]); parameters[1] = flip; } parameters[0] = time; })); break; case 13: //blink 1.0second synchronized { bool flip = false; float original = sector.brightness; float neighbor = original; foreach (Sidedef s in sector.Sidedefs) { if (s.Other != null) { if (s.Other.Sector.brightness < neighbor) { neighbor = s.Other.Sector.brightness; } } } parameters = new object[3] { original, neighbor, flip }; } UpdateActions.Add(new Action(() => { bool flip = Time.time % 2f > 1f; if (flip != (bool)parameters[2]) { parameters[2] = flip; ChangeBrightness(flip ? (float)parameters[0] : (float)parameters[1]); } })); break; default: //Debug.Log("Unknown sector type: " + sector.specialType); break; } } }