示例#1
0
        public CameraFirstPerson(Game game, float fov, float zNear, float zFar)
            : base(game, fov, zNear, zFar)
        {
            _keyboard = game.Services.GetService(typeof(KeyboardManager)) as KeyboardManager;

            _mouseManager = game.Services.GetService(typeof(MouseManager)) as MouseManager;
            _mouseManager.AddListener(this);
        }
示例#2
0
 public void onButtonReleased(MouseManager.MouseButton button)
 {
     if (button == MouseManager.MouseButton.LEFT)
     {
         _isDragging = false;
         _curOrientation = _orientation;
     }
 }
示例#3
0
 public void onButtonReleased(MouseManager.MouseButton button)
 {
     if (button == MouseManager.MouseButton.RIGHT)
     {
         _game.IsMouseVisible = !_game.IsMouseVisible;
         Mouse.SetPosition((int)_screenCenter.X, (int)_screenCenter.Y);
     }
 }
示例#4
0
        public CameraTrackBall(Game game, float fov, float zNear, float zFar)
            : base(game, fov, zNear, zFar)
        {
            _keyboard = game.Services.GetService(typeof(KeyboardManager)) as KeyboardManager;

            _mouseManager = game.Services.GetService(typeof(MouseManager)) as MouseManager;
            _mouseManager.AddListener(this);
            _curOrientation = _orientation;
        }
    // Use this for initialization
    void Start()
    {
        if (this.GetComponent<Renderer> () != null)
            this.GetComponent<Renderer> ().enabled = false;

        mMouseManager = GameObject.Find ("Towers").GetComponent<MouseManager> ();
        if (mMouseManager == null)
            Debug.LogError ("The Mouse Manager could not be found");

        this.transform.position = ParentTower.transform.position;
    }
示例#6
0
    // Use this for initialization
    void Start()
    {
        FutileParams futileParams = new FutileParams(true, true, true, true);
        manager = new MouseManager(this);
        futileParams.AddResolutionLevel(800, 1, 1, "");

        futileParams.origin = new Vector2(
            0.0f, 0.0f);
        Futile.instance.Init(futileParams);
        Futile.atlasManager.LoadImage("grasstile");
        Futile.atlasManager.LoadImage("foresttile");
        Futile.atlasManager.LoadImage("soldier");
        Futile.atlasManager.LoadImage("bluehighlight");
        var tileSize = 30;
        var width = 50;
        var height = 35;
        var tiles = new TileProperties[width, height];

        var grassTile = new TileProperties()
        {
            SpriteName = "grasstile",
            MovementPenalty = 1
        };

        var forestTile = new TileProperties()
        {
            SpriteName = "foresttile",
            MovementPenalty = 2
        };

        var actorProps = new ActorProperties()
        {
            SpriteName = "soldier",
            Name = "Hunkfort",
            MovementPoints = 5
        };

        var rand = new System.Random();
        for (int ii = 0; ii < width; ii++)
        {
            for (int jj = 0; jj < height; jj++)
            {
                tiles[ii, jj] = (rand.NextDouble() < 0.7) ? grassTile : forestTile;
            }
        }

        this.map = new Map(tiles, tileSize);
        this.map.AddActor(actorProps, new Vector2i(5, 5));
        this.map.Start();

        tileStage = new FStage("test");
        Futile.AddStage(tileStage);
        tileStage.stage.AddChild(this.map);
    }
示例#7
0
        public void onButtonPressed(MouseManager.MouseButton button)
        {
            if (!isMouseInWindow())
                return;

            MouseState mouseState = Mouse.GetState();
            if (button == MouseManager.MouseButton.LEFT)
            {
                _isDragging = true;
                _prevPosition = projectOnSphere(new Vector2(mouseState.X, mouseState.Y));
            }
        }
示例#8
0
        /// <summary>
        ///     Handles when the user presses the right mouse button
        /// </summary>
        private void HandleMousePressRight()
        {
            var view = View as SelectScreenView;

            switch (view.ActiveContainer)
            {
            case SelectContainerStatus.Difficulty:
                if (MouseManager.IsUniqueClick(MouseButton.Right))
                {
                    view.SwitchToContainer(SelectContainerStatus.Mapsets);
                }

                break;
            }
        }
示例#9
0
 public ThirdPersonPlayerController(KeyboardManager keyboardManager,
                                    MouseManager mouseManager,
                                    Camera3D camera3D,
                                    float moveSpeed, float strafeSpeed, float rotationSpeed,
                                    Keys[] moveKeys
                                    )
 {
     this.keyboardManager = keyboardManager;
     this.mouseManager    = mouseManager;
     this.camera3D        = camera3D;
     this.moveSpeed       = moveSpeed;
     this.strafeSpeed     = strafeSpeed;
     this.rotationSpeed   = rotationSpeed;
     this.moveKeys        = moveKeys;
 }
示例#10
0
        /// <summary>
        /// Input Managing
        /// </summary>
        /// <param name="engine">The Main d3d engine</param>
        /// <param name="cameraManager">The Camera Manager</param>
        /// <param name="actionType">The type presenting the collection of Actions at disposal via Const variables</param>
        public InputsManager(D3DEngine engine,
                             Type actionType,
                             bool isFixTimeStepMode = true)
        {
            _engine            = engine;
            _isFixTimeStepMode = isFixTimeStepMode;
            MouseManager       = ToDispose(new MouseManager(_engine));
            ActionsManager     = ToDispose(new ActionsManager(_engine, MouseManager, actionType));
            KeyboardManager    = ToDispose(new KeyboardManager(_engine));

            this.UpdateOrder       = 0;
            this.IsSystemComponent = true;

            this.EnableComponent();
        }
示例#11
0
    // Use this for initialization
    void Start()
    {
        if (this.GetComponent <Renderer> () != null)
        {
            this.GetComponent <Renderer> ().enabled = false;
        }

        mMouseManager = GameObject.Find("Towers").GetComponent <MouseManager> ();
        if (mMouseManager == null)
        {
            Debug.LogError("The Mouse Manager could not be found");
        }

        this.transform.position = ParentTower.transform.position;
    }
示例#12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RussLibraryGameMapping" /> class.
        /// </summary>
        public RussLibraryGameMapping()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";

            // Initialize input keyboard system
            keyboard = new KeyboardManager(this);

            // Initialize input mouse system
            mouse = new MouseManager(this);
        }
示例#13
0
文件: MyGame.cs 项目: KHCmaster/PPD
        protected override void Initialize()
        {
            base.Initialize();
            var dirs = new[] { @"img\PPD\home", @"img\PPD\main_game", @"img\PPD\single", @"img\PPD\multi" };

            foreach (var dir in dirs)
            {
                var spriteManager = new DirSpriteManager(dir);
                spriteManager.Pack();
            }
            homeResourceManager = new PPDFramework.Resource.SpriteResourceManager(device, @"img\PPD\home");
            input = PPDSetting.Setting.EveryFramePollingDisabled ?
                    new AccurateInput(Form.MainForm, PPDSetting.Setting.AccurateInputSleepTime) :
                    new Input(Form.MainForm);
            input.Load();
            sound = new Sound(Form.MainForm);
            sound.Initialize();
            keyConfigManager = new KeyConfigManager();
            keyConfigManager.Load("keyconfig.ini");
            for (int i = 0; i < PPDSetting.DefaultSounds.Length; i++)
            {
                sound.AddSound(PPDSetting.DefaultSounds[i]);
            }
            Form.MainForm.ClientSize = new System.Drawing.Size(PPDSetting.Setting.Width, PPDSetting.Setting.Height);
            mouseManager             = new MouseManager(Control, device.Offset, device.Scale);
            screenShotManager        = new ScreenShotManager(device);
            sceneManager             = new SceneManager(device)
            {
                GameHost = this
            };
            sceneManager.Update(EmptyInputInfo.Instance, MouseInfo.Empty, sound);
            movieVolumeSprite = new MovieVolumeSprite(device, this);

            timerManager = new TimerManager(gameTimer);

            if (CheckExecuteMode(out string gamePath))
            {
                LoadSpecial(gamePath);
            }
            else
            {
                InitOverray();
                LoadNormal();
            }
            LoadCommon();
            TextEditableControl.IMEStarted      += control_IMEStarted;
            TextEditableControl._EnabledChanged += control_EnabledChanged;
        }
示例#14
0
        public override void OnMouseClicked(MouseButtonID button, GameTime gameTime)
        {
            var mousePosition = MouseManager.GetMousePosition();

            Menu.OnMouseClicked(button, gameTime);

            if (!Menu.Focused)
            {
                if (_mouseDragging && button == MouseButtonID.Middle)
                {
                    _mouseDragging = false;
                }

                UnitManager.OnMouseClicked(button, gameTime);
            }
        }
示例#15
0
 // Use this for initialization
 void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         DestroyObject(gameObject);
     }
     mouseManager  = GetComponent <MouseManager>();
     cameraManager = GetComponent <CameraManager>();
     mapLoader     = GetComponent <MapLoader>();
     mapLoader.LoadMap();
     gameMap = Instantiate <GameMap>(gameMap);
 }
示例#16
0
    private void reassignGameObjs()
    {
        nextTurnObj  = GameObject.Find("NextTurnBTN2");
        nextTurnBTN2 = nextTurnObj.GetComponent <NextTurnBTN2>();

        mouseObj     = GameObject.Find("MouseManager");
        mapObj       = GameObject.Find("Map");
        mouseManager = mouseObj.GetComponent <MouseManager>();
        map          = mapObj.GetComponent <TileMap>();

        fleetCombatInfoObj = GameObject.Find("FleetCombatInfo");
        fleetCombatInfo    = fleetCombatInfoObj.GetComponent <FleetCombatInfo>();

        shipChildrenCollect = playerController.GetComponent <ShipChildrenCollect>();
        combatCalc          = playerController.GetComponent <CombatCalc>();
    }
示例#17
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Project1Game" /> class.
        /// </summary>
        public Project1Game()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Creating the keyboard manager for keyboard Camera controls
            keyboardManager = new KeyboardManager(this);

            // Creating the mouse manager for mouse Camera controls
            mouseManager = new MouseManager(this);


            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
        }
示例#18
0
        public SkyBoxGame()
        {
            _deviceManager = new GraphicsDeviceManager(this)
            {
#if DEBUG
                DeviceCreationFlags = DeviceCreationFlags.Debug,
#endif
                DepthBufferShaderResource   = true,
                PreferredDepthStencilFormat = DepthFormat.None,
                PreferredGraphicsProfile    = new[] { FeatureLevel.Level_11_0, FeatureLevel.Level_10_1, FeatureLevel.Level_10_0 }
            };

            Content.RootDirectory = "Content";
            _keyboard             = new KeyboardManager(this);
            _mouse = new MouseManager(this);
        }
示例#19
0
        public virtual void Update(GameTime gameTime)
        {
            Widgets.Update(gameTime);

            var mousePos = MouseManager.GetMousePosition();

            for (var i = 0; i < Widgets.Widgets.Count; i++)
            {
                var widget = Widgets.Widgets[i];

                if (widget.PointInsideWidget(mousePos - Position) && widget.Tooltip.Length > 0)
                {
                    PUITooltipManager.SetActiveTooltip(widget.Tooltip);
                }
            }
        }
示例#20
0
        public Actor(Game XnaGame, string ActorName, SpriteBatch LocalBatch)
            : base(XnaGame)
        {
            Name = ActorName;

            var _TmpResults = from x in this.Game.Components where x is MouseManager select x;

            _MouseManagerRef = (MouseManager)_TmpResults.First();

            foreach (var x in XnaGame.Components)
            {
                if (x is AnimationManager)
                {
                    _AnimationManagerRef = (AnimationManager)x;
                }
                else if (x is ScreenManager)
                {
                    _ScreenManager = (ScreenManager)x;
                }
                else if (x is Camera)
                {
                    _MainCamera = (Camera)x;
                }
                else if (x is TextureManager)
                {
                    _TextureManager = (TextureManager)x;
                }
                if (_AnimationManagerRef != null && _ScreenManager != null)
                {
                    break;
                }
            }

            if (!_AnimationManagerRef.ActorAnimations.Any(aa => aa.ActorName == Name))
            {
                _AnimationEngine = new AnimationEngine(this.Game, System.IO.File.ReadAllText(AppDomain.CurrentDomain.BaseDirectory + "Data\\Actors\\" + Name + "\\data.xml"), Name);
            }
            else
            {
                _AnimationEngine = new AnimationEngine(this.Game, Name);
            }

            _LocalBatch = LocalBatch;
            _MouseManagerRef.OnMouseSelectedAreaChange += new MouseSelectedAreaChanged(_MouseManagerRef_OnMouseSelectedAreaChange);
            _MouseManagerRef.OnMouseRightClick         += new MouseRightClick(_MouseManagerRef_OnMouseRightClick);
            //  _ScreenManager.Screens[_WorldPosition.WorldPointToScreenPoint()].
        }
示例#21
0
    public void Start()
    {
        SelectionMaterial.ChangeShader(gameObject, "Standard");

        Mousemanager = FindObjectOfType <MouseManager>();

        InstantiateItemContainers();

        //To make sure that each start function in the scripts happends in the right
        //order, they will be assigner here instead.
        switch (building.CurrentBuildingType)
        {
        case (BuildingList.Types.Mine):
            mine            = gameObject.AddComponent <Mine>();
            mine.building   = this;
            mine.MiningTime = MiningTime;
            break;

        case (BuildingList.Types.Conveyor):
            conveyor          = gameObject.AddComponent <Conveyor>();
            conveyor.building = this;
            break;

        case (BuildingList.Types.Splitter):
            splitter          = gameObject.AddComponent <Splitter>();
            splitter.building = this;
            break;

        case (BuildingList.Types.Smelter):
            crafting          = gameObject.AddComponent <Crafting>();
            crafting.building = this;
            break;

        default:
            break;
        }

        if (building.Outputs > 0)
        {
            StartCoroutine(CheckOuput());
        }

        if (building.Inputs > 0)
        {
            StartCoroutine(CheckInputs());
        }
    }
示例#22
0
        public ActionsManager(D3DEngine engine, MouseManager mouseManager, Type actionType)
        {
            _engine       = engine;
            _mouseManager = mouseManager;

            _keyboardActions = new List <KeyboardTriggeredAction>();
            _mouseActions    = new List <MouseTriggeredAction>();

            this.ActionType = actionType;

            _actions = _bufferedActions1;
            _bufferedActionsInProgress = _bufferedActions2;
            _isAction1Exposed          = true;

            isKeyboardActionsEnabled = true;
            isMouseActionsEnabled    = true;
        }
示例#23
0
    void Start()
    {
        _active           = gameObject.activeSelf;
        tooltip           = GameObject.Find("UI").transform.Find("Tooltip").gameObject.GetComponent <Tooltip>();
        inventoryUI       = GameObject.Find("GameManager").GetComponent <InventoryUIManager> ();
        inventorySelector = GameObject.Find("GameManager").GetComponent <InventorySelector> ();
        image             = GetComponent <Image> ();
        icon         = transform.Find("Icon").GetComponent <Image> ();
        defaultIcon  = icon.sprite;
        mouseManager = GameObject.Find("GameManager").GetComponent <MouseManager> ();

        inventory = GameObject.Find("GameManager").GetComponent <Inventory> ();
        inventory.inventoryChangedEvent += OnInventoryChanged;
        item = inventory.InventoryList [slotID];

        OnInventoryChanged();
    }
示例#24
0
        public override void Activate()
        {
            base.Activate();

            gameMap         = FindObjectOfType <GameMap>();
            log             = FindObjectOfType <MessageLog>();
            mouseManager    = FindObjectOfType <MouseManager>();
            inventoryWindow = GameplayUI.Instance.InventoryWindow;

            mouseManager.TileSelected.AddListener(OnTileSelected);
            mouseManager.EntitySelected.AddListener(OnEntitySelected);

            inventoryWindow.ItemSelected.AddListener(OnInventoryItemSelected);
            inventoryWindow.ItemDropped.AddListener(OnInventoryItemDropped);

            targetingSubState.TargetSelected.AddListener(OnTargetSelected);
        }
示例#25
0
    // Use this for initialization
    void Start()
    {
        MouseManager mouseManager = FindObjectOfType <MouseManager> ();

        foreach (GameObject shipPart in shipPartsPrefabs)
        {
            GameObject buttonGameObject = Instantiate(buttonPrefab, this.transform);
            Text       buttonLabel      = buttonGameObject.GetComponentInChildren <Text> ();
            buttonLabel.text = shipPart.name;
            Button button = buttonGameObject.GetComponent <Button> ();

            GameObject shipPartForIstantiation = shipPart;             //this is created because at every loop it creates a NEW gameObject reference.
            //whitout this, passing "shipPart" to the listener would make every button use the last shipPart of the array.

            button.onClick.AddListener(() => { mouseManager.prefabToSpawn = shipPartForIstantiation; });
        }
    }
示例#26
0
        public override void OnMouseDown(MouseButtonID button, GameTime gameTime)
        {
            var mousePosition = MouseManager.GetMousePosition();

            Menu.OnMouseDown(button, gameTime);

            if (!Menu.Focused)
            {
                if (!_mouseDragging && button == MouseButtonID.Middle)
                {
                    _mouseDragging     = true;
                    _mouseDragPosition = mousePosition;
                }

                UnitManager.OnMouseDown(button, gameTime);
            }
        }
示例#27
0
        public UIMouseObject(string id, ActorType actorType, StatusType statusType, Transform2D transform2D,
                             Color color, SpriteEffects spriteEffects, SpriteFont spriteFont,
                             string text, Vector2 textOffsetPosition, Color textColor, Vector2 textScale,
                             float layerDepth, Texture2D texture, Rectangle sourceRectangle, MouseManager mouseManager)
            : base(id, actorType, statusType, transform2D, color, layerDepth, spriteEffects, texture, sourceRectangle)
        {
            this.spriteFont    = spriteFont;
            Text               = text;
            TextOffsetPosition = textOffsetPosition;
            TextColor          = textColor;
            TextScale          = textScale;

            //used to update pointer position
            this.mouseManager = mouseManager;

            SubscribeToEvents();
        }
示例#28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SpriteBatchAndFontGame" /> class.
        /// </summary>
        public MouseInputGame()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            // Create the mouse manager
            mouseManager = new MouseManager(this);

            // Force no vsync and use real timestep to print actual FPS
            graphicsDeviceManager.SynchronizeWithVerticalRetrace = false;
            IsFixedTimeStep = false;

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";
            IsMouseVisible        = true;
        }
示例#29
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GrassRenderingApplication" /> class.
        /// </summary>
        public GrassRenderingApplication()
        {
            this.graphicsDeviceManager = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth = 3840,
                PreferredBackBufferHeight = 2400,
                PreferMultiSampling = true,
                IsFullScreen = true,
                SynchronizeWithVerticalRetrace = false,
            };

            Content.RootDirectory = "Content";

            // Input
            this.keyboard = new KeyboardManager(this);
            this.mouse = new MouseManager(this);
        }
示例#30
0
        public void Update()
        {
            if (_lastHitTest != null)
            {
                if (MouseManager.IsDown(MouseButton.Left))
                {
                    var test = _lastHitTest.HitTest();
                    if (test.IsHit)
                    {
                        return;
                    }
                    _lastHitTest = null;
                }

                _lastHitTest = null;
            }

            if (_draggable.HitTest().IsHit)
            {
                var delta = _draggable.GetMoveDelta();
                _draggable.InvalidateDelta();
                var x = ((int)(CleanRect.X - delta.X)).Clamp(0, _mainWindow.Width - CleanRect.Width);
                var y = ((int)(CleanRect.Y - delta.Y)).Clamp(0, _mainWindow.Height - CleanRect.Height);
                X = x;
                Y = y;
                _draggable.SetRect(new Rectangle(_captionBarRect.Left, _captionBarRect.Top, _captionBarRect.Width - Ui.CaptionHeight - BorderSize, _captionBarRect.Height));
                SetRect(new Rectangle(X, Y, Width, Height));
                IsDirty = true;
                return;
            }

            _ = _closeButton.HitTest();


            for (var i = _controls.Count - 1; i > -1; i--)
            {
                var test = _controls[i].HitTest();
                if (!test.IsHit)
                {
                    continue;
                }
                _lastHitTest = test.Control;
                return;
            }
        }
示例#31
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Project1Game" /> class.
        /// </summary>
        public Project1Game()
        {
            // Creates a graphics manager. This is mandatory.
            graphicsDeviceManager = new GraphicsDeviceManager(this);

            keyboardManager = new KeyboardManager(this);
            mouseManager    = new MouseManager(this);

            // Setup the relative directory to the executable directory
            // for loading contents with the ContentManager
            Content.RootDirectory = "Content";

            boundaryFront = 0;
            boundaryLeft  = 0;
            boundaryRight = Landscape.LENGTH - 1;
            boundaryTop   = Landscape.MAXSEED * 3;
            boundaryBack  = Landscape.LENGTH - 1;
        }
示例#32
0
    public override void Update()
    {
        var mousePosition2d = new Vector2(Input.mousePosition.x, Input.mousePosition.y);
        var globalCoords    = MouseManager.ScreenToGlobal(mousePosition2d);
        var gridCoords      = this.Map.GlobalToGrid(globalCoords);

        if (this.attackableLocations.Contains(gridCoords))
        {
            this.crossHair.x         = gridCoords.X * AwayTeam.TileSize + AwayTeam.TileSize / 2;
            this.crossHair.y         = gridCoords.Y * AwayTeam.TileSize + AwayTeam.TileSize / 2;
            this.crossHair.isVisible = true;
        }
        else
        {
            this.crossHair.isVisible = false;
        }
        base.Update();
    }
    void Start()
    {
        MouseManager mouseManager = GameObject.FindObjectOfType <MouseManager>();

        for (int i = 0; i < shipPartPrefabs.Length; i++)
        {
            GameObject shipPart = shipPartPrefabs[i];

            GameObject buttonGameObject = Instantiate(buildButtonPrefab);
            buttonGameObject.transform.parent = this.transform;
            Text buttonLabel = buttonGameObject.GetComponentInChildren <Text>();
            buttonLabel.text = shipPart.name;

            Button theButton = buttonGameObject.GetComponent <Button>();

            theButton.onClick.AddListener(() => { mouseManager.prefabToSpawn = shipPart; });
        }
    }
示例#34
0
    public void init(int activeCursor = 1)
    {
        //		Debug.Log("InteractiveElement[ " + this.name + " ]/init, activeCursor = " + activeCursor);
        _mouseManager = MouseManager.Instance;
        _activeCursor = activeCursor;

        if(this.transform.tag == "persistentItem") {
            this.isRoomActive = true;
        } else {
            this.isRoomActive = false;

            var eventCenter = EventCenter.Instance;
            eventCenter.onRoomEntered += this.onRoomEntered;
            eventCenter.onRoomExited += this.onRoomExited;

        }
        EventCenter.Instance.onMouseClick += this.OnMouseClick;
    }
示例#35
0
        public override void Update(GameTime gameTime)
        {
            if (MouseManager.IsInRectangle(Bounds) && MouseManager.IsClicking())
            {
                isMoving = true;
            }
            if (!MouseManager.IsClicking())
            {
                isMoving = false;
            }

            if (isMoving)
            {
                Position = MoveWindow(Position);
            }

            Bounds = new Rectangle((int)Position.X, (int)Position.Y, texture.Width, texture.Height);
        }
示例#36
0
    /// <summary>
    /// initialize all the managers
    /// </summary>
    public void Init()
    {
        boundMng = GetComponent <BoundManager>();
        if (boundMng != null)
        {
            boundMng.Init();
        }

        mouseMng = GetComponent <MouseManager>();
        if (mouseMng != null)
        {
            mouseMng.Init(this);
        }

        leaderboardMng = GetComponent <LeaderboardManager>();
        if (leaderboardMng != null)
        {
            leaderboardMng.Init();
        }

        scoreMng = GetComponent <ScoreManager>();
        if (scoreMng != null)
        {
            scoreMng.Init(this);
        }

        elementsMng = GetComponent <ElementsManager>();
        if (elementsMng != null)
        {
            elementsMng.Init(this);
        }

        timerMng = GetComponent <TimerManager>();
        if (timerMng != null)
        {
            timerMng.Init(this);
        }

        uiMng = GetComponent <UIManager>();
        if (uiMng != null)
        {
            uiMng.Init(this);
        }
    }
示例#37
0
    public void LoadStates(Block _block, Canvas _canvas, MouseManager _mouseManager, UIManager _uiManager)
    {
        block        = _block;
        canvas       = _canvas;
        mouseManager = _mouseManager;
        uiManager    = _uiManager;

        states        = block.states.ToArray();
        stateBoxes    = new StateBox[states.Length];
        keyStateBoxes = new KeyStateBox[states.Length];

        RectTransform scrollBox = gameObject.GetComponent <ScrollRect> ().content;

        scrollBox.sizeDelta = new Vector2(150, (states.Length * 55) + 5);


        for (int i = 0; i < states.Length; i++)
        {
            GameObject currentStateBox;
            if (!KeyState.isKeyState(states [i]))
            {
                currentStateBox = Instantiate(stateBoxPrefab);
            }
            else
            {
                currentStateBox = Instantiate(keyStateBoxPrefab);
            }
            currentStateBox.transform.SetParent(scrollBox.gameObject.transform, false);


            if (!KeyState.isKeyState(states [i]))
            {
                stateBoxes [i]             = currentStateBox.GetComponent <StateBox> ();
                stateBoxes [i].state       = states [i];
                stateBoxes [i].verticalPos = (-i * 50) - 5;
            }
            else
            {
                keyStateBoxes [i]             = currentStateBox.GetComponent <KeyStateBox> ();
                keyStateBoxes [i].state       = states [i];
                keyStateBoxes [i].verticalPos = (-i * 50) - 5;
            }
        }
    }
示例#38
0
        protected override void OnMouseMove(MouseEventArgs e)
        {
            base.OnMouseMove(e);
            _xValue       = e.Location.X;
            _yValue       = e.Location.Y;
            MouseOnButton = MouseManager.IsMouseInBounds(e.Location, _buttonRectangle);

            Invalidate();

            // IBeam cursor toggle
            if ((e.X > _textBox.Location.X) && (e.X < _textBox.Right))
            {
                Cursor = Cursors.IBeam;
            }
            else
            {
                Cursor = Cursors.Default;
            }
        }
        public static void Initialize(GraphicsDevice graphics, CoroutineManager manager, ContentManager content, KeyboardManager keyboard, MouseManager mouse)
        {
            _renderInterface = new LibRocketRenderInterface(graphics, content, UseVbo);
            LibRocketNet.Core.RenderInterface = _renderInterface;
            LibRocketNet.Core.SystemInterface = new LibRocketSystemInterface();
            LibRocketNet.Core.Initialize();
            MainContext = LibRocketNet.Core.CreateContext("main", new LibRocketNet.Vector2i(graphics.Viewport.Width, graphics.Viewport.Height));
            LibRocketNet.Core.InitDebugger(MainContext);
            LoadFonts();
            // add keyboard hooks

            keyboard.KeyDown += KeyDownHandler;
            keyboard.KeyUp += KeyUpHandler;
            mouse.ButtonDown +=
                (o, e) => MainContext.ProcessMouseButtonDown(e, GetKeyModifiers());
            mouse.ButtonUp +=
                (o, e) => MainContext.ProcessMouseButtonUp(e, GetKeyModifiers());

            mouse.WheelChanged += (w) => MainContext.ProcessMouseWheel(-w, GetKeyModifiers());
            mouse.Move += ProcessMouseMove;

            manager.StartCoroutine(UpdateUI());
        }
示例#40
0
        /// <summary>
        /// Initializes a new instance of the ViewManager class.
        /// </summary>
        /// <param name="model">the model to observe</param>
        public ViewManager(model.ModelManager model)
        {
            this.InitializeComponent();

            this.modelManager = model;
            this.modelManager.NodeTypesChanged += new EventHandler(this.ModelManager_NodeTypesChanged);
            this.modelManager.LinkTypesChanged += new EventHandler(this.ModelManager_LinkTypesChanged);

            this.center = new mathematics.Vector3D(0, 0, 0);
            this.visualEffectList = new List<ICE.view.visualEffect.IVisualEffect>();

            this.Settings = new setting.Settings();
            this.splachScreen = new SplashScreen();

            this.mouseManager = new MouseManager(this.gripArea);
            this.mouseManager.DragOnLeftButtonDown += new MouseEventHandler(this.BeginDragAction);
            this.mouseManager.MouseMovedOnLeftButtonDown += new MouseEventHandler(this.MoveFromMouseMovement);
            this.mouseManager.WheelMouseDown += new MouseEventHandler(this.WheelMouseDown);
            this.mouseManager.WheelMouseUp += new MouseEventHandler(this.WheelMouseUp);

            this.gripArea.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs arg)
            {
                if (this.currentActionMenu != null)
                {
                    this.currentActionMenu.Close();
                    this.currentActionMenu = null;
                }
            };

            // create the timer
            this.timer = new DispatcherTimer();
        }
示例#41
0
文件: Map.cs 项目: HaKDMoDz/awayteam
    private void Initialize(TileProperties[,] tileProperties, int size)
    {
        this.tileSize = size;
        this.halfTileSize = this.tileSize / 2f;
        this.Width = tileProperties.GetUpperBound(0) + 1;
        this.Height = tileProperties.GetUpperBound(1) + 1;
        this.actorToPoint = new Dictionary<Actor, Vector2i>();
        this.pointToActor = new Dictionary<Vector2i, Actor>();

        this.Tiles = new Tile[this.Width, this.Height];
        for (int ii = 0; ii < this.Width; ii++)
        {
            for (int jj = 0; jj < this.Height; jj++)
            {
                var tile = new Tile(tileProperties[ii,jj]);
                tile.x = ii * this.tileSize + this.tileSize / 2;
                tile.y = jj * this.tileSize + this.tileSize / 2;
                tile.width = tile.height = this.tileSize;
                this.Tiles[ii, jj] = tile;
            }
        }

        this.mouseManager = new MouseManager(this);

        this.tileInterface = new TileInterface(this);
    }
 public override void Ready()
 {
     mouseManager = GetManager<MouseManager>();
     mouseManager.Add(this);
     base.Ready();
 }
示例#43
0
 /// <summary>
 /// Set all event functions related to the main system
 /// </summary>
 public void SetViewManagement()
 {
     this.viewManager.GetView().Dispatcher.BeginInvoke(delegate
     {
         // set the actions
         this.mouseManager = new MouseManager((UIElement)this.guiComponent);
         this.mouseManager.DragOnLeftButtonDown += new MouseEventHandler(this.MouseManager_DragOnLeftButtonDown);
         this.mouseManager.DropOnLeftButtonDown += new MouseButtonEventHandler(this.MouseManager_DropOnLeftButtonDown);
         this.mouseManager.LeftButtonDown += new MouseButtonEventHandler(this.MouseManager_LeftButtonDown);
         this.mouseManager.MouseMovedOnLeftButtonDown += new MouseEventHandler(this.MouseManager_MouseMovedOnLeftButtonDown);
         ((UIElement)this.guiComponent).MouseEnter += new MouseEventHandler(this.NodeViewManager_MouseEnter);
     });
 }
示例#44
0
文件: Map.cs 项目: HaKDMoDz/awayteam
    private void Initialize(TileProperties[,] tileProperties, int size)
    {
        this.tileSize = size;
        this.halfTileSize = this.tileSize / 2f;
        this.Columns = tileProperties.GetUpperBound(0) + 1;
        this.Rows = tileProperties.GetUpperBound(1) + 1;
        this.actorToPoint = new Dictionary<Actor, Vector2i>();
        this.pointToActor = new Dictionary<Vector2i, Actor>();
        this.highlightedIndicies = new List<Vector2i>();

        this.Tiles = new Tile[this.Columns, this.Rows];
        this.highlights = new FSprite[this.Columns, this.Rows];
        for (int ii = 0; ii < this.Columns; ii++)
        {
            for (int jj = 0; jj < this.Rows; jj++)
            {
                var highlightSprite = new FSprite("bluehighlight");
                highlightSprite.x = ii * this.tileSize + this.tileSize / 2;
                highlightSprite.y = jj * this.tileSize + this.tileSize / 2;
                highlightSprite.isVisible = false;
                highlightSprite.width = highlightSprite.height = this.tileSize;
                this.highlights[ii, jj] = highlightSprite;

                var tile = new Tile(tileProperties[ii,jj]);
                tile.x = ii * this.tileSize + this.tileSize / 2;
                tile.y = jj * this.tileSize + this.tileSize / 2;
                tile.width = tile.height = this.tileSize;
                this.Tiles[ii, jj] = tile;
            }
        }

        this.mouseManager = new MouseManager(this);
    }
示例#45
0
    // ---- inherited ----
    void Awake()
    {
        if (!_instance) _instance = this;
        else return;

        states = new MouseState[5];
        if (useLeftButton)		states[0] = new MouseState(0);
        if (useRightButton)		states[1] = new MouseState(1);
        if (useMiddleButton)	states[2] = new MouseState(2);
        if (useBackButton)		states[3] = new MouseState(3);
        if (useForwardButton)	states[4] = new MouseState(4);
    }
示例#46
0
文件: MainApp.cs 项目: hubris/shaghal
 public void onButtonPressed(MouseManager.MouseButton button)
 {
 }
示例#47
0
 public override void OnInitialize()
 {
     mouseManager = GetManager<MouseManager>();
     mouseManager.RegisterMouseClick(this);
 }
示例#48
0
文件: MainApp.cs 项目: hubris/shaghal
 public void onButtonReleased(MouseManager.MouseButton button)
 {
 }
示例#49
0
文件: MainApp.cs 项目: hubris/shaghal
        /// <summary>
        /// Initilize various objects
        /// </summary>
        protected override void Initialize()
        {
            _keyboardManager = new KeyboardManager(this);
            Components.Add(_keyboardManager);
            _keyboardManager.AddListener(this);

            _mouseManager = new MouseManager(this);
            Components.Add(_mouseManager);
            _mouseManager.AddListener(this);

            //_camera = new CameraFirstPerson(this, 45, 0.01f, 100.0f);
            _camera = new CameraTrackBall(this, 45, 0.01f, 100.0f);
            _camera.Position = new Vector3(0, 0, 5);
            Components.Add(_camera);

            createVolumeRaycaster();
            _gradEditor = new GradientEditor();

            _gradient = new Gradient();
            GradientSegment seg = new GradientSegment();
            seg.Left = 0.0f;
            seg.Middle = 0.5f;
            seg.Right = 1.0f;
            seg.LeftColor = new Vector4(1, 0, 0, 1.0f);
            seg.RightColor = new Vector4(1, 0, 0, 1.0f);
            seg.ColType = GradientSegment.ColorType.HSV_CCW;
            _gradient.AddSegment(seg);

            //seg.LookUpTable = palette.Colors;
            //_gradient.AddSegment(seg);

            //seg = new GradientSegment();
            //seg.Left = 0;
            //seg.Middle = 0.333f/2.0f;
            //seg.Right = 0.333f;
            //seg.LeftColor = ColorHelper.HsvToRgb(0, 1, 0, 1.0f);
            //seg.RightColor = ColorHelper.HsvToRgb(0, 1, 0.8f, 1.0f);
            //seg.ColType = GradientSegment.ColorType.HSV_CW;
            //_gradient.AddSegment(seg);

            //seg = new GradientSegment();
            //seg.Left = 0.333f;
            //seg.Middle = 0.333f+(1.0f-0.333f) / 2.0f;
            //seg.Right = 1.0f;
            //seg.LeftColor = ColorHelper.HsvToRgb(0, 1, 0.8f, 1.0f);
            //seg.RightColor = ColorHelper.HsvToRgb(0.25f * 360.0f, 0, 1.0f, 1);
            //seg.ColType = GradientSegment.ColorType.HSV_CW;
            //_gradient.AddSegment(seg);

            _gradEditor.Gradient = _gradient;

            Color[] cols = _gradient.GetColors(256);
            _vrc.TransferFunction = cols;

            TransferFunction tf = new TransferFunction();
            tf.Colors = cols;
            tf.preIntegrate();
            _vrc.TransferFunctionPreInt = tf;

            _gradEditor.Show();

            VolumeRaycasterSettings raySettings = new VolumeRaycasterSettings(_vrc);
            raySettings.Show();

            base.Initialize();
        }