private bool onIglooDataUpdated(IglooServiceEvents.IglooDataUpdated evt)
        {
            eventChannel.RemoveListener <IglooServiceEvents.IglooDataUpdated>(onIglooDataUpdated);
            SceneLayoutData sceneLayoutData = new SceneLayoutData();

            if (evt.SignedIglooData.Data.activeLayoutId.HasValue)
            {
                layoutManager.UpdateSceneLayoutData(evt.SignedIglooData.Data.activeLayoutId.Value, evt.SignedIglooData.Data.activeLayout, sceneLayoutData);
            }
            else
            {
                Log.LogError(this, "Null layoutId returned, it's possible membership exipired at this point");
                if (layoutManager.HasCachedLayoutData())
                {
                    sceneLayoutData = layoutManager.GetCachedSceneLayoutData();
                }
            }
            logBIForSavingIglooLayout(sceneLayoutData);
            if (updateDataCallback != null)
            {
                updateDataCallback.InvokeSafe(arg1: true, sceneLayoutData);
                updateDataCallback = null;
            }
            return(false);
        }
Пример #2
0
        public bool ProcessEvents(Event e)
        {
            switch (e.type)
            {
            case EventType.MouseDown:
                HandleMouseDown(e);
                break;

            case EventType.MouseUp:
                _isHeld = false;
                break;

            case EventType.MouseDrag:
                if (e.button == 0 && _isHeld)
                {
                    Drag(e.delta);
                    e.Use();
                    return(true);
                }
                break;

            case EventType.KeyDown:
                if (e.keyCode == KeyCode.Delete && _isSelected)
                {
                    _onRemoveNode.InvokeSafe(this);
                }
                break;
            }

            return(false);
        }
 private void onSyncStopped()
 {
     if (stopSyncCallback != null)
     {
         stopSyncCallback.InvokeSafe(arg1: true, layoutManager.GetActiveSceneLayoutData());
         stopSyncCallback = null;
     }
 }
 private bool onIglooPublished(IglooServiceEvents.IglooPublished evt)
 {
     eventChannel.RemoveListener <IglooServiceEvents.IglooPublished>(onIglooPublished);
     layoutManager.UpdateActiveLayoutFromData(evt.SavedSceneLayout.layoutId, evt.SavedSceneLayout);
     if (updateAndPublishCallback != null)
     {
         updateAndPublishCallback.InvokeSafe(arg1: true, layoutManager.GetActiveSceneLayoutData());
         updateAndPublishCallback = null;
     }
     return(false);
 }
Пример #5
0
		public void OnPointerDown(PointerEventData eventData)
		{
			if (_interactable)
			{
				prevPositionInLocal = rectTransform.worldToLocalMatrix.MultiplyPoint(eventData.position);
				animator.ResetTrigger("Idle");
				animator.SetTrigger("Pressed");
				_hasInput = true;
				SelectedStateChanged.InvokeSafe(arg1: true);
			}
		}
Пример #6
0
 public IEnumerator Acquire(TypedAssetContentKey <T> content, Action <T> onAcquired)
 {
     if (Content.ContainsKey(content.Key))
     {
         if (cache.TryGetValue(content.Key, out var item))
         {
             if ((UnityEngine.Object)item.Value == (UnityEngine.Object)null)
             {
             }
             item.RefCount++;
             while ((UnityEngine.Object)item.Value == (UnityEngine.Object)null && item.RefCount > 0)
             {
                 yield return(null);
             }
         }
         else
         {
             item = new Item();
             cache.Add(content.Key, item);
             item.RefCount = 1;
             AssetRequest <T> assetRequest = Content.LoadAsync(content);
             while (!assetRequest.Finished)
             {
                 yield return(null);
             }
             if (item.RefCount <= 0)
             {
                 releaseDelegate.InvokeSafe(assetRequest.Asset, new List <UnityEngine.Object>());
                 onAcquired(null);
                 yield break;
             }
             item.Value = assetRequest.Asset;
             if (object.ReferenceEquals(item.Value, null))
             {
                 Log.LogErrorFormatted(this, "Acquiring asset '{0}' from Content system returned a null!", content);
             }
             else if ((UnityEngine.Object)item.Value == (UnityEngine.Object)null)
             {
                 Log.LogErrorFormatted(this, "Acquiring asset '{0}' from Content system returned a destroyed object!", content);
             }
         }
         onAcquired(item.Value);
         if (item.Value is ICacheableContent && (UnityEngine.Object)item.Value != (UnityEngine.Object)null)
         {
             addSubCacheReferences(item.Value as ICacheableContent);
         }
     }
     else
     {
         Log.LogErrorFormatted(this, "Asset with key '{0}' does not exist in this content version!", content.Key);
         onAcquired(null);
     }
 }
    public void Hide(Action onHidden)
    {
        if (timeHide == 0)
        {
            onHidden.InvokeSafe();
            return;
        }

        GetTweenerHide().OnComplete(() =>
        {
            onHidden.InvokeSafe();
        });
    }
Пример #8
0
        public void SetID(ScriptableID id)
        {
            _scriptID = id;

            _class = _scriptID.Class;
            _id    = _scriptID.ID;

            ObjectID = GetObjectID(Class, _id);
            if (ObjectID != INVALID_ID && !App.WorldState.Entities.HasObject(this))
            {
                OnSpawnEntity.InvokeSafe(this);
            }
        }
    public void Show(Action onShown)
    {
        if (timeShow == 0)
        {
            onShown.InvokeSafe();
            return;
        }

        GetTweenerShow().OnComplete(() =>
        {
            onShown.InvokeSafe();
        });
    }
    public void Show(Action onShown)
    {
        if (timeShow == 0)
        {
            onShown.InvokeSafe();
            return;
        }

        GetTweenerShow().OnComplete(() =>
        {
            onShown.InvokeSafe();
        });
    }
    public void Hide(Action onHidden)
    {
        if (timeHide == 0)
        {
            onHidden.InvokeSafe();
            return;
        }

        GetTweenerHide().OnComplete(() =>
        {
            onHidden.InvokeSafe();
        });
    }
Пример #12
0
 private bool onIglooCreated(IglooServiceEvents.IglooLayoutCreated evt)
 {
     eventChannel.RemoveListener <IglooServiceEvents.IglooLayoutCreated>(onIglooCreated);
     foreach (SavedIglooMetaData savedIgloo in savedIgloosMetaData.SavedIgloos)
     {
         if (savedIgloo.LayoutId == evt.SavedSceneLayout.layoutId)
         {
             layoutManager.UpdateActiveLayoutFromData(evt.SavedSceneLayout.layoutId, evt.SavedSceneLayout);
             break;
         }
     }
     createCallback.InvokeSafe(arg1: true, LayoutManager.GetActiveSceneLayoutData());
     createCallback = null;
     return(false);
 }
Пример #13
0
 public static void Create(string title, string message, string ok, Action onOk)
 {
     if (EditorUtility.DisplayDialog(title, message, ok))
     {
         onOk.InvokeSafe();
     }
 }
Пример #14
0
 private void dispatchImageReady(DataEntityHandle handle, Texture2D icon)
 {
     if (OnImageReady != null)
     {
         OnImageReady.InvokeSafe(handle, icon);
     }
 }
Пример #15
0
 protected override void onHandle(AnyKeyInputMap.Result inputResult)
 {
     if (inputResult.AnyKey.WasJustReleased)
     {
         OnInputHandled.InvokeSafe();
     }
 }
Пример #16
0
        public void Iterate()
        {
            if (_stack.Count == 0)
            {
                Completed = true;
                return;
            }

            var currentGroup = _stack.Peek();

            _callback.InvokeSafe(currentGroup.Node);
            currentGroup.Iterate();

            if (currentGroup.SubGroup != null)
            {
                _stack.Push(currentGroup.SubGroup);
            }
            else if (currentGroup.Finished)
            {
                currentGroup.Node.Calculate(); // Node is prepared. Calculate it.
                _stack.Pop();
            }

            if (_autoIterate)
            {
                Iterate();
            }
        }
Пример #17
0
 public void SendOperation <T>(T operation, Action <T, HttpResponse> on_success = null, Action <T, HttpResponse> on_failure = null, Action <T, HttpResponse> on_complete = null, params string[] parameters) where T : HttpOperation
 {
     operation["on-complete"] = (Action <T, HttpResponse>) delegate(T self, HttpResponse response)
     {
         if (isMixSessionExpired(self, response))
         {
             clearAccessToken();
             setupAuthentication(new PendingOperation
             {
                 Operation  = self,
                 Parameters = self.InParameters
             });
         }
         if (isEncryptionKeyExpired(response))
         {
             clearEncryptionKey();
             setupEncryption(new PendingOperation
             {
                 Operation  = self,
                 Parameters = self.InParameters
             });
         }
         if (on_success != null && (response.Is2XX || response.Is100) && !self.IsFaulted)
         {
             on_success.InvokeSafe(self, response);
         }
         if (on_failure != null && ((!response.Is2XX && !response.Is100) || self.IsFaulted))
         {
             on_failure.InvokeSafe(self, response);
         }
         on_complete.InvokeSafe(self, response);
     };
     sendOperation(operation, parameters);
 }
Пример #18
0
 private void OnTriggerEnter(Collider other)
 {
     if (_callback != null)
     {
         _callback.InvokeSafe(new ProjectileCollisionEvent(other, _moveDirection));
     }
 }
Пример #19
0
        public void LoadIglooLayout(long layoutId, Action <bool, SceneLayoutData, SceneLayoutData> callback)
        {
            loadLayoutCallback = callback;
            SceneLayout sceneLayout = null;

            if (layoutId != savedIgloosMetaData.ActiveIglooId)
            {
                for (int i = 0; i < savedIgloosMetaData.SavedIgloos.Count; i++)
                {
                    if (savedIgloosMetaData.SavedIgloos[i].LayoutId == layoutId)
                    {
                        sceneLayout = savedIgloosMetaData.SavedIgloos[i].SceneLayout;
                        break;
                    }
                }
            }
            if (sceneLayout != null)
            {
                SceneLayoutData sceneLayoutData = new SceneLayoutData();
                layoutManager.UpdateSceneLayoutData(layoutId, sceneLayout, sceneLayoutData);
                if (loadLayoutCallback != null)
                {
                    loadLayoutCallback.InvokeSafe(arg1: true, sceneLayoutData, null);
                    loadLayoutCallback = null;
                }
            }
            else
            {
                eventChannel.AddListener <IglooServiceEvents.IglooLayoutLoaded>(onIglooLayoutLoaded);
                iglooService.GetIglooLayout(layoutId);
            }
        }
        protected override void onLobbyItemAdded(PartygameLobbyMmoItem item)
        {
            mmoItem = item;
            long arg = item.GetTimeStartedInSecondsSinceEpoc() + item.GetTimeToLiveInSeconds() - BufferLobbyStartTime;

            LobbyStartedAction.InvokeSafe(arg);
        }
Пример #21
0
    private static void ShowVideo(Action onFinished, Action onFailed = null, Action onSkipped = null)
    {
        #if UNITY_ADS
        if (Advertisement.IsReady(rewardPlacementId))
        {
            ShowOptions options = new ShowOptions();
            options.resultCallback = result =>
            {
                switch (result)
                {
                case ShowResult.Finished:
                    onFinished.InvokeSafe();
                    break;

                case ShowResult.Failed:
                    onFailed.InvokeSafe();
                    break;

                case ShowResult.Skipped:
                    onSkipped.InvokeSafe();
                    break;
                }
            };

            Advertisement.Show(rewardPlacementId, options);
        }
        else if (EaMonetization.instance.showDebug)
        {
            Debug.Log("VIDEO is not avaiable!".color("00FFFF"));
        }
        #endif
    }
Пример #22
0
 /// <summary>
 /// ロールコンテンツの値が変更した時に呼び出される
 /// </summary>
 public void onChangedValue()
 {
     onChanged.InvokeSafe(
         int.Parse(hourDrum.SelectedContentText),
         int.Parse(minuteDrum.SelectedContentText),
         int.Parse(secondDrum.SelectedContentText));
 }
Пример #23
0
        private IEnumerator RunConversation(string conversationReference)
        {
            SetPromptVisible(false);
            IsInConversation = true;
            ConversationStarted.InvokeSafe(_currentFragment, _owner);

            while (_currentFragment != null)
            {
                if (_currentFragment.IsPlayer)
                {
                    yield return(ShowPlayerSpeech(_currentFragment.ToSay[0], _currentFragment.ToSay[1]));
                }
                else
                {
                    yield return(ShowSpeech(_currentFragment.ToSay[0], false));
                }
            }

            _talkingTo       = null;
            IsInConversation = false;

            if (ConversationFunctionLibrary.ShouldRerun(App.AIBlackboard.GetConversation(conversationReference).ShouldRerun, _owner))
            {
                _availableConversations.Insert(0, conversationReference);
            }

            ConversationEnded.InvokeSafe(_owner);

            if (_conversationTrigger.bounds.Contains(App.AIBlackboard.Player.transform.position))
            {
                SetPromptVisible(true);
            }

            _conversation = null;
        }
Пример #24
0
        public void Draw()
        {
            _drawer.Draw();

            if (Event.current.type == EventType.MouseUp && GUILayoutUtility.GetLastRect().Contains(Event.current.mousePosition))
            {
                _OnClick.InvokeSafe();
            }
        }
Пример #25
0
 private void ReturnToPool()
 {
     if (_active)
     {
         _owningPool.ReturnInstance(gameObject);
         OnReturnToPool.InvokeSafe(this);
         _active = false;
     }
 }
Пример #26
0
 public Toggle(string text, bool isChecked = false, Action <bool> onStateChanged = null, bool invokeOnStart = false)
 {
     _text           = text;
     _checked        = isChecked;
     _onStateChanged = onStateChanged;
     if (invokeOnStart)
     {
         _onStateChanged.InvokeSafe(_checked);
     }
 }
Пример #27
0
 public static void Create(string title, string message, string ok, Action onOk, string cancel, Action onCancel = null)
 {
     if (EditorUtility.DisplayDialog(title, message, ok, cancel))
     {
         onOk.InvokeSafe();
     }
     else
     {
         onCancel.InvokeSafe();
     }
 }
Пример #28
0
        public void Draw()
        {
            Handles.DrawBezier(InPoint.Rect.center, OutPoint.Rect.center,
                               InPoint.Rect.center + (Vector2.left * 50.0f),
                               OutPoint.Rect.center - (Vector2.left * 50.0f),
                               Color.white, null, 2.0f);
#pragma warning disable 0618 //This is obsolete
            if (Handles.Button((InPoint.Rect.center + OutPoint.Rect.center) * 0.5f, Quaternion.identity, 4.0f, 8.0f, Handles.RectangleCap))
            {
                _onClick.InvokeSafe(this);
            }
#pragma warning restore
        }
Пример #29
0
        public NodeEditorNodeView GetNodeViewUnderMouse(Action <NodeEditorNodeView> callback = null)
        {
            NodeEditorNodeView nodeView = null;

            nodeView = _nodeViews
                       .Values
                       .Where(x => x.Rect.Contains(InputListener.MousePosition))
                       .FirstOrDefault();

            callback.InvokeSafe(nodeView);

            return(nodeView);
        }
Пример #30
0
        public static void Run(Action action, string title, string message)
        {
            var window = ModalWindow.CreateWindow(title, new Vector2(250, 40), new Label.Label(message));

            EditorApplication.delayCall += () =>
            {
                EditorApplication.delayCall += () =>
                {
                    action.InvokeSafe();
                    window.Close();
                };
            };
        }
    public void Use(Tile targetTile, Action <bool> onCompleteCallback = null)
    {
        Assert.IsNotNull(Unit, "Owner is null.");
        Assert.IsNotNull(WeaponData, "Weapon data is missing.");
        Assert.IsNotNull(WeaponData.EffectPrototype, "Effect prototype is missing from weapon data.");
        Assert.IsFalse(WeaponData.WeaponType == WeaponType.Invalid);

        if (!Helper.CanAttackTile(Unit, targetTile, WeaponData))
        {
            onCompleteCallback.InvokeSafe(false);
            return;
        }

        if (WeaponData.WeaponType == WeaponType.Precision)
        {
            SpawnEffect(targetTile);
            onCompleteCallback.InvokeSafe(true);
        }
        else if (WeaponData.WeaponType == WeaponType.Projectile)
        {
            Assert.IsNotNull(WeaponData.ProjectilePrototype, "Projectile prototype is missing from weapon data.");

            var direction = (targetTile.transform.GetGridPosition() - Unit.transform.GetGridPosition()).normalized;

            var projectile = GameObject.Instantiate <Projectile>(WeaponData.ProjectilePrototype);
            projectile.transform.position = Unit.transform.position;

            projectile.ApplyForce(GridHelper.VectorToDirection(direction), (collision) =>
            {
                var tile = collision.Collider.GetComponentInParent <Tile>();
                if (tile != null && tile.Occupant != null && tile.Occupant != Unit)
                {
                    SpawnEffect(tile);
                    GameObject.Destroy(projectile.gameObject);
                }
            });
        }
    }
Пример #32
0
        private void Start()
        {
            if (_spawnerType == CharacterFaction.Player && !_primaryPlayerSpawnPoint)
            {
                return;
            }

            BaseCharacterController spawned = Instantiate(_config.GetPrefab(_spawnerType), transform.position, Quaternion.identity).GetComponent <BaseCharacterController>();

            spawned.OnSpawn(this, _characterConfig);

            OnSpawn.InvokeSafe(spawned);
            OnSpawnNonStatic.InvokeSafe(spawned);
        }