Пример #1
0
    private IEnumerator AreaCalc()
    {
        TakeScreenShot(16, 9);
        OnAreaChange?.Invoke(fillAmount);
        yield return(new WaitForSeconds(.05f));

        StartCoroutine(AreaCalc());
    }
Пример #2
0
 private void LateUpdate()
 {
     if (_lmbPressed == false && OnAreaChange != null)
     {
         OnAreaChangeArgs e            = new OnAreaChangeArgs();
         Vector2Int       cursorCoords = Utils.CursorToCoordinates();
         e.rectangle            = new fidt17.Utils.IntRectangle(cursorCoords, cursorCoords);
         e.startMousePosition   = cursorCoords;
         e.currentMousePosition = cursorCoords;
         e.dragEnded            = false;
         OnAreaChange.Invoke(e);
     }
 }
Пример #3
0
        public void RefreshState()
        {
            var          igsd        = Root.Game.IngameState.Data;
            AreaTemplate clientsArea = igsd.CurrentArea;
            int          curAreaHash = igsd.CurrentAreaHash;

            if (CurrentArea != null && curAreaHash == CurrentArea.Hash)
            {
                return;
            }

            CurrentArea = new AreaInstance(clientsArea, curAreaHash, igsd.CurrentAreaLevel);
            OnAreaChange?.Invoke(this);
        }
Пример #4
0
        public void RefreshState()
        {
            GController.Cache.UpdateCache();
            var          ingameData  = GController.Game.IngameState.Data;
            AreaTemplate clientsArea = ingameData.CurrentArea;
            var          curAreaHash = ingameData.CurrentAreaHash;

            if (CurrentArea != null && curAreaHash == CurrentArea.Hash)
            {
                return;
            }

            CurrentArea = new AreaInstance(clientsArea, curAreaHash, ingameData.CurrentAreaLevel);
            OnAreaChange?.Invoke(this);
        }
Пример #5
0
    private void ProcessSelectionArea(Vector2 start, Vector2 end)
    {
        DeselectEverything();
        GetSelectableInArea(start, end).ForEach(x => Select(x));
        ResetSelectionArea();
        OnSelect?.Invoke();

        if (OnAreaChange != null)
        {
            OnAreaChangeArgs e = new OnAreaChangeArgs();
            e.rectangle = new fidt17.Utils.IntRectangle(Utils.WorldToGrid(start), Utils.WorldToGrid(end));
            e.dragEnded = true;
            OnAreaChange.Invoke(e);
        }
    }
Пример #6
0
    private IEnumerator StartSelectionAreaDrag()
    {
        if (UnityEngine.EventSystems.EventSystem.current.IsPointerOverGameObject())
        {
            yield break;
        }

        _lmbPressed = true;

        Vector2 startMousePosition   = Utils.CursorToWorldPosition();
        Vector2 currentMousePosition = startMousePosition;

        while (_lmbPressed)
        {
            currentMousePosition = Utils.CursorToWorldPosition();

            if (_settings.shouldDrawArea)
            {
                DrawSelectionArea(startMousePosition, currentMousePosition);
            }

            if (OnDrag != null)
            {
                List <SelectableComponent> selectableInArea = GetSelectableInArea(startMousePosition, currentMousePosition);
                OnDrag.Invoke(selectableInArea);
            }

            if (OnAreaChange != null)
            {
                OnAreaChangeArgs e = new OnAreaChangeArgs();
                e.rectangle            = new fidt17.Utils.IntRectangle(Utils.WorldToGrid(startMousePosition), Utils.WorldToGrid(currentMousePosition));
                e.startMousePosition   = startMousePosition;
                e.currentMousePosition = currentMousePosition;
                e.dragEnded            = false;
                OnAreaChange.Invoke(e);
            }
            yield return(null);
        }

        ProcessSelectionArea(startMousePosition, currentMousePosition);
    }
Пример #7
0
 private void ActionAreaChange()
 {
     OnAreaChange?.Invoke(CurrentArea);
 }