public static void SetDataInt(string key, int data) { if (Player.Data.DataInt.ContainsKey(key)) { Player.Data.DataInt[key] = data; } else { Player.Data.DataInt.Add(key, data); } MessageKit <string> .post(Messages.GlobalDataChanged, key); }
public void OnSystemUpdate(float dt) { if (_list == null) { _list = EntityController.GetComponentArray <ModifiersContainer>(); } if (_list != null) { _list.Run(_del); MessageKit.post(Messages.ModifiersUpdated); } }
private void CloseMainMenu(int index) { if (_animating != null) { return; } _animating = _canvasGroup.FadeTo(0, _transitionLength * 0.5f, EasingTypes.SinusoidalIn, true, Tween.TweenRepeat.Once, () => _animating = null); _canvasGroup.interactable = _canvasGroup.blocksRaycasts = false; _saveLoad.Close(); Game.RemovePauseAndLockCursor("UIMainMenu"); MessageKit <GameObject> .post(Messages.MenuClosed, gameObject); }
public void Show(params System.Object[] param) { string message; try { message = string.Format(_message, param); } catch (FormatException e) { Debug.LogFormat("Received {0} and {1} but threw {2}", _message, param.Length, e); return; } MessageKit <UINotificationWindow.Msg> .post(Messages.MessageLog, new UINotificationWindow.Msg(message, _messageColor)); }
public void HandleGlobal(CollisionEvent msg) { _eventLog.Add(msg); if (msg.Hit < 0) { msg.Hit = CollisionResult.Hit; for (int h = 0; h < _globalHandlers.Count; h++) { msg.Hit = MathEx.Min(_globalHandlers[h].CheckHit(msg), msg.Hit); } } if (msg.Hit <= 0) { return; } var criticalHit = msg.Target.Entity.Get <CriticalHitCollider>(); if (criticalHit != null && criticalHit.IsCritical(msg.Target.Tr, msg.HitPoint)) { msg.Hit = CollisionResult.CriticalHit; } var ae = new ActionEvent(msg.Origin.Entity, msg.Target.Entity, msg.HitPoint, msg.HitNormal == Vector3.zero ? Quaternion.identity :Quaternion.LookRotation(msg.HitNormal), ActionState.Impact); var origin = msg.Origin.Entity.FindTemplate <CharacterTemplate>(); World.Get <RulesSystem>().Post(new ImpactEvent(msg, ae.Action, origin, msg.Target.Entity.FindTemplate <CharacterTemplate>())); msg.Origin.Post(ae); if (!_collisionMessage) { return; } _collisionString.Clear(); _collisionString.Append(msg.Origin.GetName()); if (msg.Hit == CollisionResult.CriticalHit) { _collisionString.Append(" critically hit "); } else { _collisionString.Append(" struck "); } _collisionString.Append(msg.Target.GetName()); MessageKit <UINotificationWindow.Msg> .post(Messages.MessageLog, new UINotificationWindow.Msg( _collisionString.ToString(), "", Color.blue)); if (msg.Target.Entity.HasComponent <DespawnOnCollision>()) { msg.Target.Entity.Destroy(); } }
public static void BroadcastMessage(this LockType lockType, string id, bool locked) { switch (lockType) { case LockType.Switch: MessageKit <string> .post(Messages.SwitchToggle, id); break; case LockType.Key: MessageKit <string> .post(locked?Messages.Locked : Messages.Unlocked, id); break; } }
public void HandleGlobal(CollisionEvent msg) { _eventLog.Add(msg); if (msg.Hit < 0) { msg.Hit = CollisionResult.Hit; for (int h = 0; h < _globalHandlers.Count; h++) { msg.Hit = MathEx.Min(_globalHandlers[h].CheckHit(msg), msg.Hit); } } if (msg.Hit <= 0) { return; } var criticalHit = msg.Target.Entity.Get <CriticalHitCollider>(); if (criticalHit != null && criticalHit.IsCritical(msg.Target.Tr, msg.HitPoint)) { msg.Hit = CollisionResult.CriticalHit; } var origin = msg.Origin.Entity.FindTemplate <CharacterTemplate>(); var target = msg.Target.Entity.FindTemplate <CharacterTemplate>(); PostImpactEvent(origin, target, null, msg.HitPoint, msg.HitNormal); if (!_collisionMessage) { return; } _collisionString.Clear(); _collisionString.Append(msg.Origin.GetName()); if (msg.Hit == CollisionResult.CriticalHit) { _collisionString.Append(" critically hit "); } else { _collisionString.Append(" struck "); } _collisionString.Append(msg.Target.GetName()); MessageKit <UINotificationWindow.Msg> .post(Messages.MessageLog, new UINotificationWindow.Msg( _collisionString.ToString(), "", Color.blue)); if (msg.Target.Entity.HasComponent <DespawnOnCollision>()) { msg.Target.Entity.Destroy(); } }
public void HandleGlobal(CollisionEvent msg) { _eventLog.Add(msg); if (msg.Hit < 0) { msg.Hit = CollisionResult.Hit; for (int h = 0; h < _globalHandlers.Count; h++) { msg.Hit = MathEx.Min(_globalHandlers[h].CheckHit(msg), msg.Hit); } } var blockDamage = msg.Target.Entity.Get <BlockDamage>(); if (blockDamage != null) { for (int h = 0; h < blockDamage.CollisionHandlers.Count; h++) { msg.Hit = MathEx.Min(blockDamage.CollisionHandlers[h](msg), msg.Hit); } } if (msg.Hit <= 0) { return; } var actionStateEvent = new ActionStateEvent(msg.Origin.Entity, msg.Target.Entity, msg.HitPoint, msg.HitNormal == Vector3.zero ? Quaternion.identity :Quaternion.LookRotation(msg.HitNormal), ActionStateEvents.Impact); msg.Source.PostAll(new ImpactEvent(msg, msg.Origin.Entity.FindNode <CharacterNode>(), msg.Target.Entity.FindNode <CharacterNode> ())); msg.Origin.Post(actionStateEvent); if (!_collisionMessage) { return; } _collisionString.Clear(); _collisionString.Append(msg.Origin.GetName()); _collisionString.Append(" struck "); _collisionString.Append(msg.Target.GetName()); MessageKit <UINotificationWindow.Msg> .post(Messages.MessageLog, new UINotificationWindow.Msg( _collisionString.ToString(), "", Color.blue)); if (msg.Target.Entity.HasComponent <DespawnOnCollision>()) { msg.Target.Entity.Destroy(); } }
private void LoadFile(string path) { string text = FileUtility.ReadFile(path); if (string.IsNullOrEmpty(text)) { return; } var saveGame = JsonConvert.DeserializeObject <SerializedSaveGame>(text, Serializer.ConverterSettings); if (saveGame == null) { Debug.LogErrorFormat("Error deserializing save game {0}", path); return; } MessageKit.post(Messages.ToggleMainMenu); saveGame.Load(); }
public void OnSystemUpdate(float dt, float unscaledDt) { if (_allInputBlocked || LocalInput == null) { return; } CheckDebugInput(); if (LocalInput.GetButtonDown(PlayerControls.Menu)) { if (OnCancel != null) { CancelCurrent(); } else if (UIBasicMenu.OpenMenus.Count > 0) { UIBasicMenu.CloseAll(); } else if (Game.GameActive) { MessageKit.post(Messages.ToggleMainMenu); } } LocalInput.RunUpdate(); }
private static void PauseChanged() { MessageKit.post(Messages.PauseChanged); //UnityEngine.Time.timeScale = Paused ? 0f : 1f; //UnityEngine.Time.fixedDeltaTime = 0.02f * Mathf.Clamp(UnityEngine.Time.timeScale, 0.00001f, 1); }
public virtual void Teleport(Vector3 location) { Tr.position = FindFloorPoint(location); MessageKit.post(Messages.PlayerTeleported); }
public virtual void NewGame() { Player.DefaultCurrencyHolder.ChangeValue(100); MessageKit.post(Messages.PlayerNewGame); }
protected virtual void OnDeath() { MessageKit.post(Messages.PlayerDead); Game.SetGameActive(false); }
public virtual void NewGame() { _currency.ChangeValue(100); MessageKit.post(Messages.PlayerNewGame); }
//private void OpenScores(int index) { // FadeOut(IndexMain); // FadeIn(IndexHighScores); // UIScoreList.main.ListScores(); //} //public void CloseScores() { // FadeIn(IndexMain); // FadeOut(IndexHighScores); //} private void OpenPartyManagement(int index) { MessageKit.post(Messages.SetupNewGame); //FadeOut(IndexMain); //FadeIn(IndexClass); }
void OnApplicationFocus(bool focusStatus) { MessageKit <bool> .post(Messages.ApplicationFocus, focusStatus); }
public void PostCurrentStrings(Color color) { MessageKit <UINotificationWindow.Msg> .post(Messages.MessageLog, new UINotificationWindow.Msg(_logMsg.ToString(), _hoverMsg.ToString(), color)); }