public void Init(SystemContainer container) { _obj = new GameObject("UpdateManager"); UpdateBehaviour behaviour = _obj.AddComponent <UpdateBehaviour>(); behaviour.StartCoroutine(UpdateCoroutine()); }
/* Set Group Modifier * Set same modifier for all animations */ public UIGroupAnimation SetGroupModifier(UpdateBehaviour mod) { for (int i = 0; i < animations.Length; i++) { animations[i].SetModifier(mod); } return(this); }
protected ModSettings() { this.Behaviour = UpdateBehaviour.Create(typeof(T).Name); this.Behaviour.OnDestroyAction = delegate() { this.OnDeinitialize(); ModSettings <T> ._current = default(T); }; this.OnInitialize(); Initialized = true; }
private void OnDisconnected(object sender, EventArgs eventArgs) { UpdateBehaviour.RemoveUpdate(this); Status = ClientNetworkStatus.Disconnected; m_ClientSocket.OnConnect -= OnConnected; m_ClientSocket.OnReceive -= OnReceived; m_ClientSocket.OnDisconnect -= OnDisconnected; m_ClientSocket = null; }
public bool Disconnect() { if (m_ClientSocket != null && (Status == ClientNetworkStatus.Connecting || Status == ClientNetworkStatus.Connected)) { UpdateBehaviour.RemoveUpdate(this); Status = ClientNetworkStatus.Disconnecting; m_ClientSocket.Disconnect(); return(true); } return(false); }
public static IUpdateBehaviour GetUpdateBehaviour(this UpdateBehaviour behaviour) { switch (behaviour) { case UpdateBehaviour.Append: return(new AppendBehaviour()); case UpdateBehaviour.Overwrite: return(new OverwriteBehaviour()); case UpdateBehaviour.SetIfEmpty: default: return(new SetIfEmptyBehaviour()); } }
public SpellDetails( double maxDistance, double cooldown, int speed, double channelTime, bool ignoreDrawDepth, UpdateBehaviour updateBehaviour, HitBehaviour hitBehaviour ) { this.maxDistance = maxDistance; this.cooldown = cooldown; this.speed = speed; this.channelTime = channelTime; this.ignoreDrawDepth = ignoreDrawDepth; this.updateBehaviour = updateBehaviour; this.hitBehaviour = hitBehaviour; }
public void Disconnect() { if (m_serverSocket != null) { UpdateBehaviour.RemoveUpdate(this); m_serverSocket.OnClientConnect -= OnClientConnected; m_serverSocket.OnClientDisconnect -= OnClientDisconnected; m_serverSocket.OnReceive -= OnReceived; m_serverSocket.OnDisconnect -= OnDisconnected; if (m_serverSocket.IsConnected) { m_serverSocket.Disconnect(); } m_serverSocket = null; } }
public bool Connect(string ipString, int port) { if (m_ClientSocket != null) { return(false); } m_ClientSocket = new TcpClientSocket(); m_ClientSocket.OnConnect += OnConnected; m_ClientSocket.OnReceive += OnReceived; m_ClientSocket.OnDisconnect += OnDisconnected; Status = ClientNetworkStatus.Connecting; m_ClientSocket.Connect(IPAddress.Parse(ipString), port); UpdateBehaviour.AddUpdate(this); return(true); }
public void Listen(int port) { if (m_Port != port && m_serverSocket != null) { DebugLog.Warning(""); Disconnect(); } m_Port = port; m_serverSocket = new TcpServerSocket(); m_serverSocket.OnClientConnect += OnClientConnected; m_serverSocket.OnClientDisconnect += OnClientDisconnected; m_serverSocket.OnReceive += OnReceived; m_serverSocket.OnDisconnect += OnDisconnected; m_serverSocket.Listen(m_Port); UpdateBehaviour.AddUpdate(this); }
public void SetAliases(VaultStructureElements names, CaseConverter converter, UpdateBehaviour behaviour, bool dryRun) { var aliasUpdateBehaviour = behaviour.GetUpdateBehaviour(); if (names?.ObjectType != null) { UpdateObjTypeAliases(names.ObjectType, converter, aliasUpdateBehaviour, dryRun); } if (names?.ValueList != null) { UpdateValueListAliases(names.ValueList, converter, aliasUpdateBehaviour, dryRun); } if (names?.PropertyDef != null) { UpdatePropertyDefAliases(names.PropertyDef, converter, aliasUpdateBehaviour, dryRun); } if (names?.Class != null) { UpdateClassAliases(names.Class, converter, aliasUpdateBehaviour, dryRun); } if (names?.Workflow != null) { UpdateWorkflowAliases(names.Workflow, converter, aliasUpdateBehaviour, dryRun); } if (names?.State != null) { UpdateStateAliases(names.State, converter, aliasUpdateBehaviour, dryRun); } if (names?.StateTransition != null) { UpdateStateTransitionAliases(names.StateTransition, converter, aliasUpdateBehaviour, dryRun); } if (names?.UserGroup != null) { UpdateUserGroupAliases(names.UserGroup, converter, aliasUpdateBehaviour, dryRun); } if (names?.NamedACL != null) { UpdateNamedACLAliases(names.NamedACL, converter, aliasUpdateBehaviour, dryRun); } }
/* Set Modifier * Add modifier to animation. * * Modifier change how the timer affects the animation. */ public UIAnimation SetModifier(UpdateBehaviour updateBehaviour) { this.updateBehaviour = updateBehaviour; return(this); }
public void RemoveFn(UpdateBehaviour update) { _removeUpdateQueue.Add(update); }
public void AddFn(UpdateBehaviour update) { _addUpdateQueue.Add(update); }
public void GetDependencies(GlobalBehaviourService behaviourService) { behavior = behaviourService.GetBehavior <UpdateBehaviour>(); }
// Update is called once per frame void Update() { UpdateBehaviour?.Invoke(); }
// Use this for initialization void Start() { if (Application.isPlaying && uiAnimation != null) { return; } rect = GetComponent <RectTransform>(); if (rect == null) { Debug.Log("Please add a RectTransform to this object:" + gameObject.name); return; } List <UIAnimation> animations = new List <UIAnimation>(); if (moveAnimation) { UpdateBehaviour mod = EasyUIAnimatorUtils.GetModifier(moveModifier); Effect.EffectUpdate eff = EasyUIAnimatorUtils.GetEffect(moveEffect, max[0], bounce[0]); effectRotation = (randomDirection) ? Vector3.forward * Random.Range(0, 360) : effectRotation; Vector2 startValue = (useScreenValues) ? Vector3.Scale(start[0], (Vector3)UIAnimator.InvertedScreenDimension) : start[0]; Vector2 finalValue = (useScreenValues) ? Vector3.Scale(final[0], (Vector3)UIAnimator.InvertedScreenDimension) : final[0]; if (isBezier) { if (isCubicBezier) { animations.Add(UIAnimator.MoveBezier(rect, startValue, finalValue, bezierP1, bezierP2, duration).SetModifier(mod)); } else { animations.Add(UIAnimator.MoveBezier(rect, startValue, finalValue, bezierP1, duration).SetModifier(mod)); } } else { animations.Add(UIAnimator.Move(rect, startValue, finalValue, duration).SetModifier(mod).SetEffect(eff, Quaternion.Euler(effectRotation))); } } if (scaleAnimation) { UpdateBehaviour mod = EasyUIAnimatorUtils.GetModifier(scaleModifier); Effect.EffectUpdate eff = EasyUIAnimatorUtils.GetEffect(scaleEffect, max[1], bounce[1]); animations.Add(UIAnimator.Scale(rect, start[1], final[1], duration).SetModifier(mod).SetEffect(eff)); } if (rotationAnimation) { UpdateBehaviour mod = EasyUIAnimatorUtils.GetModifier(rotationModifier); Effect.EffectUpdate eff = EasyUIAnimatorUtils.GetEffect(rotationEffect, max[2], bounce[2]); if (start[2].x != 0 || start[2].y != 0 || final[2].x != 0 || final[2].y != 0) { animations.Add(UIAnimator.Rotate(rect, Quaternion.Euler(start[2]), Quaternion.Euler(final[2]), duration).SetModifier(mod).SetEffect(eff)); } else { animations.Add(UIAnimator.Rotate(rect, start[2].z, final[2].z, duration).SetModifier(mod).SetEffect(eff)); } } if (graphicAnimation) { UpdateBehaviour mod = EasyUIAnimatorUtils.GetModifier(graphicModifier); image = GetComponent <Graphic>(); if (!image) { Debug.LogError("Please attach an Image/Text component to the gameObject"); } else { animations.Add(UIAnimator.ChangeColor(image, startColor, finalColor, duration).SetDelay(delay).SetModifier(mod)); } } if (animations.Count == 0) { Debug.Log("No animation"); return; } else { uiAnimation = new UIGroupAnimation(animations.ToArray()).SetDelay(delay); } switch (loop) { case Loop.LOOP: uiAnimation.SetLoop(); break; case Loop.PING_PONG: uiAnimation.SetLoop(true); break; } if (playAudioOnPlay) { audioSource = GetComponent <AudioSource>(); if (audioSource == null) { Debug.LogError("No audio source found!"); } } if (disableAfter) { uiAnimation.SetCallback(() => { gameObject.SetActive(false); }); } if (Application.isPlaying) { if (playOnStart) { Play(); } } }
void Start() { if (Application.isPlaying && uiAnimation != null) { return; } rect = GetComponent <RectTransform>(); UpdateBehaviour mMod = EasyUIAnimatorUtils.GetModifier(mod); Effect.EffectUpdate mEff = EasyUIAnimatorUtils.GetEffect(effect, max, bounce); effectRotation = (randomDirection) ? Vector3.forward * Random.Range(0, 360) : effectRotation; switch (animType) { case AnimationType.MOVE: if (useScreenValues) { uiAnimation = UIAnimator.Move(rect, Vector3.Scale(startV3, (Vector3)UIAnimator.InvertedScreenDimension), Vector3.Scale(finalV3, (Vector3)UIAnimator.InvertedScreenDimension), duration).SetDelay(delay).SetModifier(mMod).SetEffect(mEff, Quaternion.Euler(effectRotation)); } else { uiAnimation = UIAnimator.Move(rect, startV3, finalV3, duration).SetDelay(delay).SetModifier(mMod).SetEffect(mEff, Quaternion.Euler(effectRotation)); } break; case AnimationType.SCALE: uiAnimation = UIAnimator.Scale(rect, startV3, finalV3, duration).SetDelay(delay).SetModifier(mMod).SetEffect(mEff, Quaternion.Euler(effectRotation)); break; case AnimationType.ROTATION: if (startV3.x != 0 || startV3.y != 0 || finalV3.x != 0 || finalV3.y != 0) { uiAnimation = UIAnimator.Rotate(rect, Quaternion.Euler(startV3), Quaternion.Euler(finalV3), duration).SetDelay(delay).SetModifier(mMod).SetEffect(mEff, Quaternion.Euler(effectRotation)); } else { uiAnimation = UIAnimator.Rotate(rect, startV3.z, finalV3.z, duration).SetDelay(delay).SetModifier(mMod).SetEffect(mEff, Quaternion.Euler(effectRotation)); } break; case AnimationType.IMAGE: image = GetComponent <Graphic>(); if (!image) { Debug.LogError("Please attach an Image component to the gameObject"); uiAnimation = null; return; } uiAnimation = UIAnimator.ChangeColor(image, startColor, finalColor, duration).SetDelay(delay).SetModifier(mMod); break; case AnimationType.GROUP: UIAnimation[] uiAnimations = new UIAnimation[fixedAnimations.Length]; for (int i = 0; i < uiAnimations.Length; i++) { uiAnimations[i] = fixedAnimations[i].uiAnimation; } uiAnimation = new UIGroupAnimation(uiAnimations); break; default: break; } switch (loop) { case Loop.LOOP: uiAnimation.SetLoop(); break; case Loop.PING_PONG: uiAnimation.SetLoop(true); break; } if (disableAfter) { uiAnimation.SetCallback(() => { gameObject.SetActive(false); }); } if (Application.isPlaying) { if (playOnStart) { Play(); } } }