Exemplo n.º 1
0
 public static void OpenMainWindow()
 {
     if (mWindow != null)
     {
         mWindow.Close();
         mWindow = null;
     }
     mWindow              = GetWindow <GauntletEditorMain>();
     mWindow.minSize      = new Vector2(1100, 850);
     mWindow.titleContent = new GUIContent("Gauntlet Game Editor Main");
 }
Exemplo n.º 2
0
    void ClickGrid(MouseUpEvent pEvent)
    {
        if (pEvent.localMousePosition.x <= (mLevelMapScrollerSize.x - 15))
        {
            if (pEvent.localMousePosition.y >= 20 && pEvent.localMousePosition.y <= (mLevelMapScrollerSize.y + 5))
            {
                Vector2    postion = pEvent.localMousePosition + mLevelMapGUIScrollPos + new Vector2(0, -20);
                Vector2Int actP    = new Vector2Int((int)postion.x / mCellSize, (int)postion.y / mCellSize);
                if (actP.x >= mActiveLevel.mColumns || actP.y >= mActiveLevel.mRows)
                {
                    return;
                }

                if (mActiveBrushId == -1)
                {
                    return;
                }
                if (mActiveLayer == Level.LayerTypes.Players && mActiveBrushId <= 1)
                {
                    if (mActiveBrushId == 0)
                    {
                        SetResetStartPosition(actP);
                    }
                    else
                    {
                        SetResetEndPosition(actP);
                    }
                }
                else
                {
                    GameScriptable aObject = GetActiveBrushObject();
                    if (aObject != null)
                    {
                        if (IsScriptablePresent(actP, aObject))
                        {
                            RemoveScriptable(actP, aObject);
                        }
                        else
                        {
                            if (!IsLayerObjectPresent(actP, mActiveLayer))
                            {
                                AddScriptable(actP, aObject);
                            }
                        }
                    }
                }
                GauntletEditorMain.DoRepaint();
            }
        }
        else if (pEvent.localMousePosition.x > (mLevelMapScrollerSize.x + 15) && pEvent.localMousePosition.x < (mLevelMapScrollerSize.x + mPlaceableObjectsScrollerSize.x))
        {
            if (pEvent.localMousePosition.y >= 45 && pEvent.localMousePosition.y <= (mPlaceableObjectsScrollerSize.y + 5))
            {
                Vector2 postion = pEvent.localMousePosition + mPlaceableObjectsGUIScrollPos + new Vector2(0, -45);
                int     actP    = (int)postion.y / (mCellSize + 25);
                if (actP >= mActiveBrushesCount)
                {
                    return;
                }
                mActiveBrushId = actP;
                GauntletEditorMain.DoRepaint();
            }
        }
    }