Ejemplo n.º 1
0
    // Use this for initialization
    void Start()
    {
        SpriteRenderer sceneRend = scene.GetComponent <SpriteRenderer>();

        xMin = (sceneRend.bounds.extents.x * -1) - Camera.main.ScreenToWorldPoint(Vector2.zero).x + 0.1f;
        xMax = (sceneRend.bounds.extents.x) + Camera.main.ScreenToWorldPoint(Vector2.one).x - 0.1f;

        transform.position = new Vector3(xMin, 0, -10);

        cursor = GameObject.Find("Cursor").GetComponent <CursorHandler>();
    }
Ejemplo n.º 2
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         //DontDestroyOnLoad(gameObject);
     }
     else
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 3
0
    private void Awake()
    {
        scr = gameObject.AddComponent <Screen>();

        cursorRect   = cursor.GetComponent <RectTransform>();
        cursorScript = cursor.GetComponent <CursorHandler>();

        buttonColDef = buttonBackground.color;

        RefreshScreen();
        RefreshTexts();
    }
Ejemplo n.º 4
0
        public override bool HitTest(Point p)
        {
            bool result = false;

            if (Edge != null)
            {
                var sp = Camera.ToSource(p);
                hitAnchor = Scene.ItemShape(Edge).IsAnchorHit(sp, HitSize);
                CursorHandler.SetEdgeCursor(hitAnchor);
                result = hitAnchor != Anchor.None;
            }
            return(result);
        }
Ejemplo n.º 5
0
Archivo: Deck.cs Proyecto: GeralfM/CTD
    // Use this for initialization
    void Awake()
    {
        myReader = GameObject.Find("MainHandler").GetComponent <Reader>();
        myCursor = GameObject.Find("MainHandler").GetComponent <CursorHandler>();

        foreach (string str in new List <string>()
        {
            "W"
        })
        {
            resourcesButton.Add(str, GameObject.Find(str + "_res"));
        }
    }
Ejemplo n.º 6
0
        internal ContentHandler(GraphicsDevice graphicsDevice, SpriteBatch spriteBatch, 
            Level level, Camera camera, ResourceHandler resourceHandler)
        {
            SpriteHandler = new SpriteHandler();
            KeyboardHandler = new KeyboardHandler();
            CursorHandler = new CursorHandler();
            //EffectHandler = new EffectHandler();
            ResourceHandler = resourceHandler;

            this.SpriteBatch = spriteBatch;
            this.Level = level;
            this.Camera = camera;
            this.graphicsDevice = graphicsDevice;
        }
Ejemplo n.º 7
0
    private void Awake()
    {
        scr = gameObject.AddComponent <Screen>();

        cursorRect   = cursor.GetComponent <RectTransform>();
        cursorScript = cursor.GetComponent <CursorHandler>();

        buttonBgImg  = buttonBackground.GetComponent <Image>();
        buttonBgRect = buttonBackground.GetComponent <RectTransform>();

        buttonColDef = buttonBgContainerImg.color;

        starVisScreen = GameObject.Find("Star Visualisation Screen").GetComponent <StarVisScreen>();
    }
Ejemplo n.º 8
0
    // Use this for initialization
    void Awake()
    {
        controller     = GameObject.FindGameObjectWithTag("Controller");
        CH             = controller.GetComponent <CursorHandler> ();
        spriteRenderer = GetComponent <SpriteRenderer>();

        particleSystems = GetComponentsInChildren <ParticleSystem>();
        particleNumbers = new float[particleSystems.Length];

        for (int i = 0; i < particleNumbers.Length; i++)
        {
            particleNumbers[i] = particleSystems[i].emissionRate;
        }
    }
Ejemplo n.º 9
0
 protected override void EndAction()
 {
     //if (Resolved) {
     CursorHandler.RestoreCursor();
     resizing     = false;
     moving       = false;
     LastMousePos = Point.Zero;
     MouseDownPos = Point.Zero;
     hitAnchor    = Anchor.None;
     if (SelectionRenderer != null)
     {
         SelectionRenderer.UpdateSelection();
     }
     //}
     base.EndAction();
 }
    protected virtual void Awake()
    {
        pTextMeshPro  = GetComponent <TextMeshProUGUI>();
        pCanvas       = GetComponentInParent <Canvas>();
        cursorHandler = FindObjectOfType <CursorHandler>();

        // Get a reference to the camera if Canvas Render Mode is not ScreenSpace Overlay.
        if (pCanvas.renderMode == RenderMode.ScreenSpaceOverlay)
        {
            pCamera = null;
        }
        else
        {
            pCamera = pCanvas.worldCamera;
        }
    }
Ejemplo n.º 11
0
    void Start()
    {
        player        = GameObject.FindGameObjectWithTag("Player");
        controller    = GameObject.FindGameObjectWithTag("Controller");
        cursorHandler = controller.GetComponent <CursorHandler> ();

        if (lantern != null)
        {
            lantern.SetActive(false);
            takeComponentsFromObjects();

            //valori dei bounds di default del raggio
            boundsRay = spRendRay.bounds;
            xSize     = boundsRay.size.x;
            ySize     = boundsRay.size.y;
        }
    }
Ejemplo n.º 12
0
    void Start()
    {
        canvasPlayingUI = GameObject.FindGameObjectWithTag("CanvasPlayingUI");
        if (canvasPlayingUI == null)
        {
            Debug.Log("ATTENZIONE!! canvasPlayingUI non trovato!! Assicurarsi che il relativo prefab sia nella scena");
        }
        else
        {
            playingUI = canvasPlayingUI.GetComponent <PlayingUI> ();
        }

        controller    = GameObject.FindGameObjectWithTag("Controller");
        cursorHandler = controller.GetComponent <CursorHandler> ();

        Sprite[] sprites = new Sprite[1];
        sprites [0] = info;


        if (playingUI != null)
        {
            playingUI.setSprites(sprites, PlayingUI.UIPosition.UpperRight);
        }

        Sprite buttonSprite;

        if (cursorHandler.useController)
        {
            buttonSprite = controllerButton;
        }
        else
        {
            buttonSprite = keyboardButton;
        }

        if (playingUI != null)
        {
            playingUI.setButtonSprite(PlayingUI.UIPosition.UpperRight, buttonSprite);

            playingUI.setVerticalButton(PlayingUI.UIPosition.UpperRight, false);
            playingUI.setSpritesSize(PlayingUI.UIPosition.UpperRight, PlayingUI.UISize.Big);

            playingUI.updateSpritesOnScreen(PlayingUI.UIPosition.UpperRight);
        }
    }
Ejemplo n.º 13
0
        void Start()
        {
            if (!MobileInput)
            {
                CursorHandler.LockCursor();
            }

            //初始化LuaInputManager
            _luaInputManager = LuaManager.Instance.GetLuaTable("LuaInputManager");
            _luaInit         = (LuaFunction)_luaInputManager["Init"];
            _luaOnTouchStart = (LuaFunction)_luaInputManager["OnTouchStart"];
            _luaOnTouchUp    = (LuaFunction)_luaInputManager["OnTouchUp"];
            _luaOnSwipeStart = (LuaFunction)_luaInputManager["OnSwipeStart"];
            _luaOnSwipe      = (LuaFunction)_luaInputManager["OnSwipe"];
            _luaOnSwipeEnd   = (LuaFunction)_luaInputManager["OnSwipeEnd"];
            _luaOnSimpleTap  = (LuaFunction)_luaInputManager["OnSimpleTap"];
            _luaOnLongTap    = (LuaFunction)_luaInputManager["OnLongTap"];
            _luaOnLongTapEnd = (LuaFunction)_luaInputManager["OnLongTapEnd"];

            _luaInit.call(_luaInputManager, this);
        }
Ejemplo n.º 14
0
    //bool mPlayCirculation = false;

    //float mTimer;
    //float mTotalTime;



    //MouseOpMgr.MouseOpCursor mCurState = MouseOpMgr.MouseOpCursor.Null;

    void Start()
    {
        mTrans = transform;
        if (uiCamera == null)
        {
            uiCamera = NGUITools.FindCameraForLayer(gameObject.layer);
        }
        ch      = new CursorHandler();
        ch.Type = CursorState.EType.None;
        //mTimer = 0;
        //mTotalTime = 0.75f;
        m_TipScaleTween.onFinished = TipTweenFinish;

        //mMouseHandBig = "mouse_hand";
        //mMouseHandSmall = "mouse_hand1";
        mBag       = "mouse_get";
        mAxe       = "mouse_axe";
        mNouseTalk = "mouse_talk";
        mHand      = "mouse_help";
        mRide      = "mouse_ride";
        mDefault   = "sighting_3";
    }
Ejemplo n.º 15
0
 protected override void OnMouseMoveNotResolved(MouseActionEventArgs e)
 {
     if (HitTest(e.Location))
     {
         ShowGrips = true;
         if (_selectionRenderer != null)
         {
             this.SelectionRenderer.ShowGrips = true;
         }
         hideGrips = true;
     }
     else if (hideGrips)
     {
         ShowGrips = false;
         if (_selectionRenderer != null)
         {
             this.SelectionRenderer.ShowGrips = false;
         }
         hideGrips = false;
         CursorHandler.RestoreCursor();
     }
 }
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player");

        //assignMainCameraToPlayer ();

        getGameOverObject();

        controller    = GameObject.FindGameObjectWithTag("Controller");
        cursorHandler = controller.GetComponent <CursorHandler> ();

        cameraHandler = Camera.main.gameObject.GetComponent <CameraHandler> ();

        magicLanternLogic = GameObject.FindGameObjectWithTag("MagicLanternLogic").GetComponent <MagicLantern> ();

        UpperLimit  = cursorHandler.getUpperLimit();
        BottomLimit = cursorHandler.getBottomLimit();
        RightLimit  = cursorHandler.getRightLimit();
        LeftLimit   = cursorHandler.getLeftLimit();

        if (cameraHandler == null)
        {
            cameraCenter       = new Vector3(Camera.main.gameObject.transform.position.x, Camera.main.gameObject.transform.position.y, player.transform.position.z);
            beginCamera        = Camera.main.ScreenToWorldPoint(new Vector3(0.0f, 0.0f, player.transform.position.z));
            xDistFromBeginning = Mathf.Abs(cameraCenter.x - beginCamera.x);
            yDistFromBeginning = Mathf.Abs(cameraCenter.y - beginCamera.y);

            Debug.Log("CameraHandler non trovato nell'oggetto Camera");
        }
        else
        {
            xDistFromBeginning = cameraHandler.getXDistFromBeginning();
            yDistFromBeginning = cameraHandler.getYDistFromBeginning();
        }

        ratioDistanceFromPlayer = standardRatioDistance;
        setCameraSize(defaultSize);
    }
Ejemplo n.º 17
0
 public static NSCursor ToNS(this Cursor cursor) => CursorHandler.GetControl(cursor);
Ejemplo n.º 18
0
    void Update()
    {
        CursorType cursor = CursorType.Default;

        if (!EventSystem.current.IsPointerOverGameObject())
        {
            if (CastingSkill)
            {
                cursor = CursorType.CastSkill;
            }
            Ray        ray = Camera.main.ScreenPointToRay(Input.mousePosition);
            RaycastHit hit;
            if (Physics.Raycast(ray, out hit))
            {
                int x = (int)hit.point.x;
                int y = (int)hit.point.z;
                if (hit.transform.tag == "Map")
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        if (!MapMetrics.InsideMap(y, x))
                        {
                            if (curRegion != null)
                            {
                                curRegion.Selected = false;
                            }
                            curRegion = null;
                            if (army != null)
                            {
                                DeselectArmy();
                            }
                        }
                        else
                        {
                            RegionTap(Main.regions[regionIndex[y, x]]);
                        }
                    }

                    if (Input.GetMouseButtonDown(1))
                    {
                        army?.TryMoveTo(hit.point);
                        ship?.TryMoveTo(hit.point);
                        if (curPort)
                        {
                            curPort.ShipOut(hit.point);
                        }
                    }
                }
                State      other  = null;
                IFightable target = null;
                if (hit.transform.tag == "Unit")
                {
                    Army sel = hit.transform.GetComponent <Army>();
                    if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
                    {
                        ArmyTap(sel, Input.GetMouseButtonDown(0));
                    }
                    other  = sel.curOwner;
                    target = sel;
                    if (CastingSkill)
                    {
                        if (CastSkill is IArmyCastable cast)
                        {
                            if (cast.CanCastOnArmy(sel))
                            {
                                cursor = CursorType.CanCastSkill;
                            }
                        }
                    }
                    else
                    {
                        if (other == curPlayer && sel != army)
                        {
                            cursor = CursorType.Select;
                        }
                    }
                }
                if (hit.transform.tag == "Ship")
                {
                    Ship sel = hit.transform.GetComponent <Ship>();
                    if (Input.GetMouseButtonDown(0) || Input.GetMouseButtonDown(1))
                    {
                        ShipTap(sel, Input.GetMouseButtonDown(0));
                    }
                    other = sel.curOwner;
                    if (CastingSkill)
                    {
                    }
                    else
                    {
                        if (other == curPlayer && sel != ship)
                        {
                            cursor = CursorType.Select;
                        }
                    }
                }
                if (hit.transform.tag == "Town")
                {
                    Region reg = MapMetrics.regions[int.Parse(hit.transform.name)];
                    highlightRegion = reg;
                    TownTap(reg, Input.GetMouseButtonDown(0), Input.GetMouseButtonDown(1));
                    reg.bar.Active = true;
                    other          = reg.curOwner;
                    target         = reg;
                    if (CastingSkill)
                    {
                        if (CastSkill is IRegionCastable cast)
                        {
                            if (cast.CanCastOnRegion(reg))
                            {
                                cursor = CursorType.CanCastSkill;
                            }
                        }
                    }
                    else
                    {
                        if (other == curPlayer && reg != curRegion)
                        {
                            cursor = CursorType.Select;
                        }
                    }
                }
                else
                {
                    if (highlightRegion != null)
                    {
                        highlightRegion.bar.Active = false;
                    }
                }
                if (hit.transform.GetComponent <Port>())
                {
                    Port port = hit.transform.GetComponent <Port>();
                    if (Input.GetMouseButtonDown(0) && port.curOwner == curPlayer && port.Ship)
                    {
                        curPort = port;
                        DeselectShip();
                    }
                    if (Input.GetMouseButtonDown(1) && ship && port.CanshipOn(ship))
                    {
                        ship.TryMoveTo(port);
                    }
                }
                if (!CastingSkill && target != null && army != null && army.CanAttack(target, TargetType))
                {
                    switch (TargetType)
                    {
                    case DamageType.Melee:
                    case DamageType.Charge: cursor = CursorType.MeleeAttack; break;

                    case DamageType.Range: cursor = CursorType.RangeAttack; break;

                    case DamageType.Siege: cursor = CursorType.SiegeAttack; break;
                    }
                }
            }
        }
        if (curRegion == null)
        {
            MenuManager.HiddenProvinceMenu();
        }
        if (cursor != cursorType)
        {
            cursorType = cursor;
            CursorHandler.SetCursor(cursorType);
        }
    }
Ejemplo n.º 19
0
 private void Start()
 {
     CursorHandler.SetCursor(cursorType);
 }
Ejemplo n.º 20
0
 private void Start()
 {
     cursorHandler = FindObjectOfType <CursorHandler>();
 }
Ejemplo n.º 21
0
 // ===============================================================================
 //                                                                          Select
 //                                                                          ======
 public Object SelectCursor(String path, PARAMETER_BEAN pmb, CursorHandler handler)
 {
     return(_outsideSqlDao.SelectCursor(path, pmb, _outsideSqlOption, handler));
 }
Ejemplo n.º 22
0
 void Start()
 {
     cursorHandler   = FindObjectOfType <CursorHandler>();
     panelsManager   = FindObjectOfType <PanelsManager>();
     phraseConverter = FindObjectOfType <PhraseConverter>();
 }
Ejemplo n.º 23
0
    // Use this for initialization
    void Awake()
    {
        controller = GameObject.FindGameObjectWithTag("Controller");
        if (controller != null)
        {
            cursorHandler = controller.GetComponent <CursorHandler>();
        }

        player = GameObject.FindGameObjectWithTag("Player");
        if (player != null)
        {
            playerMovements = player.GetComponent <PlayerMovements>();
        }

        magicLanternLogicOBJ = GameObject.FindGameObjectWithTag("MagicLanternLogic");
        if (magicLanternLogicOBJ != null)
        {
            magicLanternLogic   = magicLanternLogicOBJ.GetComponent <MagicLantern>();
            magicLanternGraphic = magicLanternLogicOBJ.GetComponent <GraphicLantern>();
            glassesManager      = magicLanternLogicOBJ.GetComponent <GlassesManager>();
        }

        magicLantern = GameObject.FindGameObjectWithTag("Lantern");

        canvasPlayingUI = GameObject.FindGameObjectWithTag("CanvasPlayingUI");
        if (canvasPlayingUI != null)
        {
            playingUI         = canvasPlayingUI.GetComponent <PlayingUI>();
            playingUILateral  = canvasPlayingUI.GetComponent <PlayingUILateral>();
            playingUIGameOver = canvasPlayingUI.GetComponent <PlayingUIGameOver>();
        }

        canvasMenu = UtilFinder._FindGameObjectByTag("CanvasMenu");

        unlockableContentUI = UtilFinder._GetComponentOfGameObjectWithTag <UnlockableContentUI> ("Controller");
        informativeManager  = UtilFinder._GetComponentOfGameObjectWithTag <InformativeManager> ("MenuController");
        menuManager         = UtilFinder._GetComponentOfGameObjectWithTag <MenuManager> ("MenuController");
        playStatusTracker   = UtilFinder._GetComponentOfGameObjectWithTag <PlayStatusTracker> ("Controller");

        testInformativeManager = UtilFinder._GetComponentOfGameObjectWithTag <TestInformativeManager> ("TestController");
        testingController      = GameObject.FindGameObjectWithTag("TestController");
        if (testingController != null)
        {
            hintAnalyzer = testingController.GetComponent <HintAnalyzer>();
        }

        hubController = GameObject.FindGameObjectWithTag("HubController");
        if (hubController != null)
        {
            unlockedLevelControl = hubController.GetComponent <UnlockedLevelControl>();
            hubLadderControl     = hubController.GetComponent <HubLadderControl>();
            hubLanternControl    = hubController.GetComponent <HubLanternControl>();
        }

        if (controller != null)
        {
            inputKeeper = controller.GetComponent <InputKeeper>();
        }

        camera = Camera.main.gameObject;
        if (camera != null)
        {
            cameraMovements = camera.GetComponent <CameraMovements>();
            cameraHandler   = camera.GetComponent <CameraHandler>();
        }

        GameObject levelChanger = GameObject.FindGameObjectWithTag("CanvasLoadLevel");

        if (levelChanger != null)
        {
            levelChangerGeneral = levelChanger.GetComponent <LevelChangerGeneral> ();
        }

        GameObject buttonControllerOBJ = GameObject.FindGameObjectWithTag("ButtonControllerLink");

        if (buttonControllerOBJ != null)
        {
            buttonController    = buttonControllerOBJ.GetComponent <ButtonController> ();
            inputManager        = buttonControllerOBJ.GetComponent <InputManager>();
            buttonKeyboardMouse = buttonControllerOBJ.GetComponent <ButtonKeyboardMouse>();
        }
    }
 void initializeComponents()
 {
     cursorHandler = UtilFinder._GetComponentOfGameObjectWithTag <CursorHandler> ("Controller");
 }
Ejemplo n.º 25
0
 void Awake()
 {
     inst = this;
     activateCourser(startWithCursorActiv);
 }
Ejemplo n.º 26
0
 public void Initialize(CursorHandler h)
 {
     gameboard = h.gameboard;
     baseTile  = h.baseTile;
     tile      = baseTile;
 }
Ejemplo n.º 27
0
 public static Gdk.Cursor ToGdk(this Cursor cursor) => CursorHandler.GetControl(cursor);
Ejemplo n.º 28
0
 public static swf.Cursor ToSwf(this Cursor cursor) => CursorHandler.GetControl(cursor);
Ejemplo n.º 29
0
 /**
  * Set the default cursor handler
  */
 private void Awake()
 {
     _handler = FindObjectOfType <CursorHandler>();
 }
Ejemplo n.º 30
0
 // Use this for initialization
 void Start()
 {
     infosPanel = GameObject.Find("Description");
     myReader   = GameObject.Find("MainHandler").GetComponent <Reader>();
     myCursor   = GameObject.Find("MainHandler").GetComponent <CursorHandler>();
 }
Ejemplo n.º 31
0
 private void Start()
 {
     rb = GetComponent <Rigidbody>();
     CursorHandler.ToggleCursor(false);
 }