public WatchSpinner(EvasObject parent, CircleSurface surface) : base(parent, surface) { Style = ThemeConstants.CircleSpinner.Styles.Circle; _wheelAppeared = new SmartEvent(this, ThemeConstants.CircleSpinner.Signals.ShowList); _wheelDisappeared = new SmartEvent(this, ThemeConstants.CircleSpinner.Signals.HideList); _wheelAppeared.On += (s, e) => WheelAppeared?.Invoke(this, EventArgs.Empty); _wheelDisappeared.On += (s, e) => WheelDisappeared?.Invoke(this, EventArgs.Empty); }
public static SmartEvent GetInstance() { if (instance == null) { instance = new SmartEvent(new SmartGenericJSONData()); instance.ID = 61; instance.readable = " Linked"; } return(instance); }
public static SmartEvent GetInstance() { if (instance == null) { instance = new SmartEvent(new SmartGenericJSONData()); instance.ID = 61; instance.readable = " Linked"; } return instance; }
public InspectionResult?Inspect(SmartEvent e) { bool hasBeginInlineActionList = false; for (var index = 0; index < e.Actions.Count; index++) { var prev = index > 0 ? e.Actions[index - 1] : null; var a = e.Actions[index]; if (a.Id == SmartConstants.ActionBeginInlineActionList) { if (!hasBeginInlineActionList) { hasBeginInlineActionList = true; } } if (a.Id == SmartConstants.ActionAfterMovement) { if (prev == null) { return new InspectionResult() { Severity = DiagnosticSeverity.Error, Line = a.LineId, Message = "`After previous movement` action cannot be the very first event action! It makes no sense" } } ; if (!hasBeginInlineActionList) { return new InspectionResult() { Severity = DiagnosticSeverity.Error, Line = a.LineId, Message = "`After previous movement` action can only work within `begin inline actionlist` at the moment" } } ; if (prev.Id != SmartConstants.ActionStartWaypointsPath) { return new InspectionResult() { Severity = DiagnosticSeverity.Error, Line = a.LineId, Message = "`After previous movement` action can only be placed after `Waypoint path start` action!" } } ; } } return(null); } } }
void InitializeComponent() { _mainBox = new Box(Forms.NativeParent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _mainBox.Show(); _mainBox.SetLayoutCallback(OnLayout); _indexIndicator = new Index(_mainBox) { IsHorizontal = true, AutoHide = false, Style = IndexStyle.Circle, }; _indexIndicator.Show(); _scroller = new Scroller(_mainBox); _scroller.Scrolled += OnScrolled; _scroller.PageScrolled += OnScrollStop; //PageScrolled event is not invoked when a user scrolls beyond the end using bezel var scrollAnimationStop = new SmartEvent(_scroller, "scroll,anim,stop"); scrollAnimationStop.On += OnScrollStop; _scroller.Focused += OnFocused; _scroller.Unfocused += OnUnfocused; // Disables the visibility of the scrollbar in both directions: _scroller.HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible; _scroller.VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible; // Sets the limit of scroll to one page maximum: _scroller.HorizontalPageScrollLimit = 1; _scroller.SetPageSize(1.0, 1.0); _scroller.SetAlignment(-1, -1); _scroller.SetWeight(1.0, 1.0); _scroller.Show(); _innerContainer = new Box(_mainBox); _innerContainer.SetLayoutCallback(OnInnerLayoutUpdate); _innerContainer.SetAlignment(-1, -1); _innerContainer.SetWeight(1.0, 1.0); _innerContainer.Show(); _scroller.SetContent(_innerContainer); _mainBox.PackEnd(_indexIndicator); _mainBox.PackEnd(_scroller); _indexIndicator.StackAbove(_scroller); }
public void UpdateEvent(SmartEvent ev, int id) { if (ev.Id == id) { return; } SmartGenericJsonData raw = smartDataManager.GetRawData(SmartType.SmartEvent, id); SetParameterObjects(ev, raw, true); }
public MTextField(EvasObject parent) : base(parent) { _changed = new SmartEvent(this, this.RealHandle, Events.Changed); _changed.On += OnChanged; Focused += OnFocused; Unfocused += OnUnfocused; IsSingleLine = true; MColors.AddColorSchemeComponent(this); }
public static string GenerateComment(SmartEvent ev, SmartAction action) { StringBuilder comment = new StringBuilder(); comment.Append(ev); comment.Append(" - "); comment.Append(action); comment.Append(" // " + action.Comment); return(comment.ToString()); }
public static string GenerateComment(SmartEvent ev, SmartAction action) { StringBuilder comment = new StringBuilder(); comment.Append(ev); comment.Append(" - "); comment.Append(action); comment.Append(" // " + action.Comment); return comment.ToString(); }
public InspectionResult?Inspect(SmartEvent e) { if (e.GetParameter(pram).Value != 0 || (e.Flags.Value & (int)SmartEventFlag.NotRepeatable) != 0) { return(null); } return(new InspectionResult() { Line = e.LineId, Message = $"`{parameterName}` is 0, the event will be triggered only once. If this is on purpose, add NOT_REPEATABLE flag.", Severity = DiagnosticSeverity.Error }); }
public InspectionResult?Inspect(SmartEvent e) { if (e.Actions.Count != 0) { return(null); } return(new InspectionResult() { Severity = DiagnosticSeverity.Warning, Message = "Event has no actions, will not be saved to database.", Line = e.LineId }); }
public MTextField(EvasObject parent) : base(parent) { _changed = new SmartEvent(this, this.RealHandle, Events.Changed); _changed.On += OnChanged; _defaultTextColor = GetPartColor(Parts.TextEdit); _defaultLabelColor = _layout.GetPartColor(Parts.Label); _defaultBackgroundColor = _layout.BackgroundColor; Focused += OnFocused; Unfocused += OnUnfocused; IsSingleLine = true; }
protected override void OnElementChanged(ElementChangedEventArgs <CarouselView> e) { base.OnElementChanged(e); if (e.NewElement != null) { Control.Scrolled += OnScrolled; Control.Scroll.DragStart += OnDragStart; Control.Scroll.DragStop += OnDragStop; _animationStart = new SmartEvent(Control.Scroll, Control.Scroll.RealHandle, ThemeConstants.Scroller.Signals.StartScrollAnimation); _animationStart.On += OnScrollStart; } UpdatePositionFromElement(false); UpdateCurrentItemFromElement(false); }
public InspectionResult?Inspect(SmartEvent e) { bool wasWait = false; foreach (var a in e.Actions) { if (a.Id == SmartConstants.ActionWait) { wasWait = true; } if (!wasWait) { continue; } if (a.Source.Id != SmartConstants.SourceNone) { var sourceData = e.Parent?.TryGetSourceData(a.Source); if (sourceData.HasValue && sourceData.Value.IsInvoker) { return new InspectionResult() { Severity = DiagnosticSeverity.Error, Line = a.LineId, Message = "You may not use action invoker after wait action, core limitation" } } ; } if (a.Target.Id != SmartConstants.TargetNone) { var sourceData = e.Parent?.TryGetSourceData(a.Target); if (sourceData.HasValue && sourceData.Value.IsInvoker) { return new InspectionResult() { Severity = DiagnosticSeverity.Error, Line = a.LineId, Message = "You may not use action invoker after wait action, core limitation" } } ; } } return(null); } } }
private void AddEventCommand() { int?id = _container.Resolve <ISmartTypeListProvider>().Get(SmartType.SmartEvent, data => { return(data.ValidTypes == null || data.ValidTypes.Contains(script.SourceType)); }); if (id.HasValue) { SmartEvent ev = _container.Resolve <ISmartFactory>().EventFactory(id.Value); EditEventCommand(ev); script.Events.Add(ev); } }
private void RemoveEvent(SmartEvent smartEvent) { smartEvent.Actions.CollectionChanged -= Actions_CollectionChanged; smartEvent.Chance.OnValueChanged -= Parameter_OnValueChanged; smartEvent.Flags.OnValueChanged -= Parameter_OnValueChanged; smartEvent.Phases.OnValueChanged -= Parameter_OnValueChanged; smartEvent.CooldownMin.OnValueChanged -= Parameter_OnValueChanged; smartEvent.CooldownMax.OnValueChanged -= Parameter_OnValueChanged; for (int i = 0; i < SmartEvent.SmartEventParamsCount; ++i) { smartEvent.GetParameter(i).OnValueChanged -= Parameter_OnValueChanged; } }
protected override void OnRealized() { base.OnRealized(); _scrollAnimationStart = new SmartEvent(this, RealHandle, "scroll,anim,start"); _scrollAnimationStop = new SmartEvent(this, RealHandle, "scroll,anim,stop"); _scrollAnimationStart.On += (s, e) => _isAnimation = true; _scrollAnimationStop.On += (s, e) => { if (_animationTaskComplateSource != null) { _animationTaskComplateSource.TrySetResult(true); } _isAnimation = false; }; }
public InspectionResult?Inspect(SmartEvent ev) { var valid = validator.Evaluate(new SmartValidationContext(ev.Parent !, ev, null)); if (!valid) { return(new InspectionResult() { Severity = rule.Level, Message = rule.Description, Line = ev.LineId }); } return(null); }
public CollectionView(EvasObject parent) : base(parent) { AllowFocus(true); SetLayoutCallback(OnLayout); Scroller = CreateScroller(parent); Scroller.Show(); PackEnd(Scroller); Scroller.Scrolled += OnScrolled; _scrollAnimationStop = new SmartEvent(Scroller, ThemeConstants.Scroller.Signals.StopScrollAnimation); _scrollAnimationStop.On += OnScrollStopped; _innerLayout = new EBox(parent); _innerLayout.SetLayoutCallback(OnInnerLayout); _innerLayout.Show(); Scroller.SetContent(_innerLayout); }
public void TestPlayerHealth() { int testValue = 100; SmartEvent.OnReceiveEvent <PlayerHealthEvent>(this, evt => { Assert.AreEqual(testValue, evt.Health); }); SmartEvent.Broadcast(new PlayerHealthEvent() { Health = 100 }); SmartEvent.Clear(); }
public SmartEvent EventFactory(ISmartScriptLine line) { SmartEvent ev = EventFactory(line.EventType); ev.Chance.Value = line.EventChance; ev.Phases.Value = line.EventPhaseMask; ev.Flags.Value = line.EventFlags; ev.CooldownMin.Value = line.EventCooldownMin; ev.CooldownMax.Value = line.EventCooldownMax; for (var i = 0; i < SmartEvent.SmartEventParamsCount; ++i) { ev.GetParameter(i).Value = line.GetEventParam(i); } return(ev); }
public SmartEvent EventFactory(ISmartScriptLine line) { SmartEvent ev = EventFactory(line.EventType); ev.Chance.SetValue(line.EventChance); ev.Phases.SetValue(line.EventPhaseMask); ev.Flags.SetValue(line.EventFlags); ev.CooldownMin.SetValue(line.EventCooldownMin); ev.CooldownMax.SetValue(line.EventCooldownMax); for (int i = 0; i < SmartEvent.SmartEventParamsCount; ++i) { ev.SetParameter(i, GetEventParameter(line, i)); } return(ev); }
public WatchSpinner(EvasObject parent, CircleSurface surface) : base(parent, surface) { Style = "circle"; if (TizenDotnetUtil.TizenAPIVersion == 4) { _wheelAppeared = new ElmSharp.SmartEvent(this, "genlist,show"); _wheelDisappeared = new ElmSharp.SmartEvent(this, "genlist,hide"); } else { _wheelAppeared = new ElmSharp.SmartEvent(this, "list,show"); _wheelDisappeared = new ElmSharp.SmartEvent(this, "list,hide"); } _wheelAppeared.On += (s, e) => WheelAppeared?.Invoke(this, EventArgs.Empty); _wheelDisappeared.On += (s, e) => WheelDisappeared?.Invoke(this, EventArgs.Empty); }
private AbstractSmartScriptLine GenerateSingleSai(int eventId, SmartEvent ev, SmartAction action, int link = 0, string comment = null) { AbstractSmartScriptLine line = new AbstractSmartScriptLine { EntryOrGuid = _item.Entry, ScriptSourceType = (int)_item.SmartType, Id = eventId, Link = link, EventType = ev.Id, EventPhaseMask = ev.Phases.Value, EventChance = ev.Chance.Value, EventFlags = ev.Flags.Value, EventParam1 = ev.GetParameter(0).Value, EventParam2 = ev.GetParameter(1).Value, EventParam3 = ev.GetParameter(2).Value, EventParam4 = ev.GetParameter(3).Value, EventCooldownMin = ev.CooldownMin.Value, EventCooldownMax = ev.CooldownMax.Value, ActionType = action.Id, ActionParam1 = action.GetParameter(0).Value, ActionParam2 = action.GetParameter(1).Value, ActionParam3 = action.GetParameter(2).Value, ActionParam4 = action.GetParameter(3).Value, ActionParam5 = action.GetParameter(4).Value, ActionParam6 = action.GetParameter(5).Value, SourceType = action.Source.Id, SourceParam1 = action.Source.GetParameter(0).Value, SourceParam2 = action.Source.GetParameter(1).Value, SourceParam3 = action.Source.GetParameter(2).Value, SourceConditionId = action.Source.Condition.Value, TargetType = action.Target.Id, TargetParam1 = action.Target.GetParameter(0).Value, TargetParam2 = action.Target.GetParameter(1).Value, TargetParam3 = action.Target.GetParameter(2).Value, TargetConditionId = action.Target.Condition.Value, TargetX = action.Target.X, TargetY = action.Target.Y, TargetZ = action.Target.Z, TargetO = action.Target.O, Comment = ev.Readable + " - " + action.Readable }; return(line); }
private void EditEventCommand(SmartEvent ev) { ParametersEditView v = new ParametersEditView(); List <KeyValuePair <Parameter, string> > paramss = new List <KeyValuePair <Parameter, string> >(); paramss.Add(new KeyValuePair <Parameter, string>(ev.Chance, "General")); paramss.Add(new KeyValuePair <Parameter, string>(ev.Flags, "General")); paramss.Add(new KeyValuePair <Parameter, string>(ev.Phases, "General")); paramss.Add(new KeyValuePair <Parameter, string>(ev.CooldownMax, "General")); paramss.Add(new KeyValuePair <Parameter, string>(ev.CooldownMin, "General")); for (int i = 0; i < ev.ParametersCount; ++i) { paramss.Add(new KeyValuePair <Parameter, string>(ev.GetParameter(i), "Event specific")); } v.DataContext = new ParametersEditViewModel(_container, ev, paramss); v.ShowDialog(); }
public InspectionResult?Inspect(SmartEvent e) { foreach (var a in e.Actions) { if (a.Id == waitActionId) { return new InspectionResult() { Severity = DiagnosticSeverity.Error, Line = a.LineId, Message = "You can not use 'WAIT' in On Death event. When the creature dies, it is no longer updated, so no action can be played with a delay" } } ; } return(null); } }
private void UnbindEvent(SmartEvent smartEvent) { foreach (var act in smartEvent.Actions) { UnbindAction(act); } smartEvent.Actions.CollectionChanged -= Actions_CollectionChanged; smartEvent.Chance.OnValueChanged -= Parameter_OnValueChanged; smartEvent.Flags.OnValueChanged -= Parameter_OnValueChanged; smartEvent.Phases.OnValueChanged -= Parameter_OnValueChanged; smartEvent.CooldownMin.OnValueChanged -= Parameter_OnValueChanged; smartEvent.CooldownMax.OnValueChanged -= Parameter_OnValueChanged; for (int i = 0; i < SmartEvent.SmartEventParamsCount; ++i) { smartEvent.GetParameter(i).OnValueChanged -= Parameter_OnValueChanged; } }
private void InitializeSmartEvent() { // focus dummy _focusIn = new SmartEvent(this, "focused"); _focusOut = new SmartEvent(this, "unfocused"); _focusIn.On += (s, e) => { ((WebView)s).SetFocus(true); }; _focusOut.On += (s, e) => { ((WebView)s).SetFocus(false); }; _loadStarted = new SmartEvent(this, _realHandle, "load,started"); _loadFinished = new SmartEvent(this, _realHandle, "load,finished"); _loadError = new SmartEvent <SmartCallbackLoadErrorArgs>(this, _realHandle, "load,error", SmartCallbackLoadErrorArgs.CreateFromSmartEvent); _titleChanged = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "title,changed", SmartCallbackArgs.CreateFromSmartEvent); _urlChanged = new SmartEvent <SmartCallbackArgs>(this, _realHandle, "url,changed", SmartCallbackArgs.CreateFromSmartEvent); _loadStarted.On += (s, e) => { LoadStarted?.Invoke(this, EventArgs.Empty); }; _loadFinished.On += (s, e) => { LoadFinished?.Invoke(this, EventArgs.Empty); }; _loadError.On += (s, e) => { LoadError?.Invoke(this, e); }; _titleChanged.On += (s, e) => { TitleChanged?.Invoke(this, e); }; _urlChanged.On += (s, e) => { UrlChanged?.Invoke(this, e); }; }
private void BindEvent(SmartEvent smartEvent) { smartEvent.BulkEditingStarted += OnBulkEditingStarted; smartEvent.BulkEditingFinished += OnBulkEditingFinished; smartEvent.Chance.OnValueChanged += Parameter_OnValueChanged; smartEvent.Flags.OnValueChanged += Parameter_OnValueChanged; smartEvent.Phases.OnValueChanged += Parameter_OnValueChanged; smartEvent.CooldownMin.OnValueChanged += Parameter_OnValueChanged; smartEvent.CooldownMax.OnValueChanged += Parameter_OnValueChanged; for (int i = 0; i < SmartEvent.SmartEventParamsCount; ++i) { smartEvent.GetParameter(i).OnValueChanged += Parameter_OnValueChanged; } smartEvent.Actions.CollectionChanged += Actions_CollectionChanged; foreach (var smartAction in smartEvent.Actions) { BindAction(smartAction); } }
/// <summary> /// Initializes a new instance of the CarouselView class. /// </summary> #pragma warning disable CS8618 public CollectionView(EvasObject parent) : base(parent) #pragma warning restore CS8618 { AllowFocus(true); SetLayoutCallback(OnLayout); Scroller = new EScroller(parent); Scroller.Show(); PackEnd(Scroller); Scroller.Scrolled += OnScrolled; _scrollAnimationStart = new SmartEvent(Scroller, ThemeConstants.Scroller.Signals.StartScrollAnimation); _scrollAnimationStart.On += OnScrollStarted; _scrollAnimationStop = new SmartEvent(Scroller, ThemeConstants.Scroller.Signals.StopScrollAnimation); _scrollAnimationStop.On += OnScrollStopped; Scroller.DragStart += OnDragStart; Scroller.KeyDown += OnKeyDown; _innerLayout = new EBox(parent); _innerLayout.SetLayoutCallback(OnInnerLayout); _innerLayout.Show(); Scroller.SetContent(_innerLayout); }
public SmartEvent EventFactory(int id) { if (!smartDataManager.Contains(SmartType.SmartEvent, id)) { throw new NullReferenceException("No data for event id " + id); } SmartEvent ev = new SmartEvent(id); var raw = smartDataManager.GetRawData(SmartType.SmartEvent, id); ev.Chance.SetValue(100); SetParameterObjects(ev, raw); if (raw.DescriptionRules != null) { ev.DescriptionRules = new List <DescriptionRule>(); foreach (var rule in raw.DescriptionRules) { ev.DescriptionRules.Add(new DescriptionRule(rule)); } } return(ev); }
public SmartEventProperty(SmartEvent ev) : base(ev) { m_dctd.GetProperty("name").SetCategory("Event"); m_dctd.GetProperty("name").SetDisplayName("Event name"); }
private static string GenerateSingleSAI(SAIType sourcetype, int entry, int id, SmartEvent ev, SmartAction action, int link = 0) { object data = new { entryorguid = (entry<0?"@GUID":"@ENTRY"), source_type = ((int)sourcetype).ToString(), id = id.ToString(), linkto = link.ToString(), event_id = ev.ID.ToString(), phasemask = ((int)ev.phasemask).ToString(), chance = ev.chance.ToString(), flags = ((int)ev.flags).ToString(), event_param1 = ev.parameters[0].GetValue().ToString(), event_param2 = ev.parameters[1].GetValue().ToString(), event_param3 = ev.parameters[2].GetValue().ToString(), event_param4 = ev.parameters[3].GetValue().ToString(), action_id = action.ID.ToString(), action_param1 = action.parameters[0].GetValue().ToString(), action_param2 = action.parameters[1].GetValue().ToString(), action_param3 = action.parameters[2].GetValue().ToString(), action_param4 = action.parameters[3].GetValue().ToString(), action_param5 = action.parameters[4].GetValue().ToString(), action_param6 = action.parameters[5].GetValue().ToString(), target_id = action.Target.ID.ToString(), target_param1 = action.Target.parameters[0].GetValue().ToString(), target_param2 = action.Target.parameters[1].GetValue().ToString(), target_param3 = action.Target.parameters[2].GetValue().ToString(), target_position = String.Join(", ", action.Target.position), comment = CommentGenerator.GenerateComment(ev, action) }; return SmartFormat.Smart.Format(SAI_SQL, data); }
public void OnButtonClick(int which) { DebugUtil.Assert(this.candidates.Count > which); Candidate candidate = this.candidates[which]; DebugUtil.Assert(candidate != null); // TODO: Only taking the first event TransitionEvent evt = candidate.Edge.Events[0]; DebugUtil.Assert(evt != null); this.DeselectAll(evt); EventSignature sig = (EventSignature)evt.Descriptor; SmartEvent instance = sig.Create(this.GetParameters(evt)); string output = evt.Descriptor.Name; foreach (object parameter in this.GetParameters(evt)) { SmartObject obj = (SmartObject)parameter; output += " " + obj.gameObject.name; } Debug.LogWarning("Executing: " + output); instance.StartEvent(1.0f); this.previousGoal = candidate.Goal; this.Depopulate(); this.currentEvent = instance; this.currentEdge = candidate.Edge; }
//private EventPopulation FindPopulation(EventSignature sig) //{ // List<EventPopulation> applicable = // new List<EventPopulation>( // sig.GetValidPopulations( // ObjectManager.Instance.GetObjects().Cast<IHasState>())); // if (applicable != null && applicable.Count > 0) // return applicable[rnd.Next(applicable.Count)]; // return null; //} void Update() { // Are we running an event? if (this.currentEvent != null) { if (this.currentEvent.Behavior.Status == EventStatus.Finished) { this.currentEvent = null; this.Advance(); } } else if (this.currentEvent == null) { // Do we have a populated edge list? if (this.candidates.Count == 0) { DisableAllButtons(); //this.Populate(this.currentScorer, this.descending); this.PopulateAdjacent(this.currentScorer, this.descending); } else { for (int i = 0; i < this.labels.Length; i++) { if (i < this.candidates.Count && this.candidates[i] != null) { this.labels[i].text = this.candidates[i].Edge.Events[0].Descriptor.Name; this.buttons[i].gameObject.SetActive(true); } } } } }
public InspectionResult?Inspect(SmartEvent e) { return(Inspect((SmartBaseElement)e)); }
/// <summary> /// Terminates the given event if the status of the other event is finished. /// </summary> /// <param name="evnt">The status of the other event.</param> /// <param name="newStatus">The event to possibly terminate.</param> private void TerminationDependencyHandler(SmartEvent evnt, EventStatus newStatus) { if (newStatus == EventStatus.Finished) { evnt.Behavior.StopEvent(); } }