コード例 #1
0
    void LeftClick()
    {
        currentBtn = USearch.FindBtnInColl(menusArrayOne, Program.MOUSEOVERTHIS);

        if (Input.GetMouseButtonUp(0))
        {
            //if MOUSEOVERTHIS not null
            if (Program.MOUSEOVERTHIS != null)
            {
                LobbyHandleMenu(Program.MOUSEOVERTHIS.name);
                //audioPlayer.PlayAudio(RootSound.clickMenuSound, H.Sound);

                //will pop up new menus
                //will pop up new Raws and Elements
                if (Program.MOUSEOVERTHIS.name.Contains("Select_") && Application.loadedLevelName != "Lobby")
                {
                    UponLeftClickOnMenu(Program.MOUSEOVERTHIS.name);
                }
                else if (Application.loadedLevelName != "Lobby")
                {
                    CloseCurrentMenu();
                }
            }
            //click outside the buttons bascially MOUSEOVERTHIS == null...
            else if (Application.loadedLevelName != "Lobby")
            {
                CloseCurrentMenu();
            }
        }
    }
コード例 #2
0
ファイル: MenuHandler.cs プロジェクト: naaturaz/SM
    /// <summary>
    /// Will act for each btn set actiion .. this method is implemented in all child classes too
    /// </summary>
    /// <param name="setOfBtns"></param>
    internal void ActionableBtnClick(Button[] setOfBtns)//actionable buttons
    {
        //make sure there is not two obj in the array with the same name or contains partial part of the same name
        currentBtn = USearch.FindBtnInColl(setOfBtns, Program.MOUSEOVERTHIS.name);

        if (currentBtn == null)
        {
            return;
        }
        else if (currentBtn.btnAction == Btn.SelectMale1)
        {
            SelectPlayerRoutine(setOfBtns, Root.boardMale1);
        }
        else if (currentBtn.btnAction == Btn.SelectMale2)
        {
            SelectPlayerRoutine(setOfBtns, Root.boardMale2);
        }
        else if (currentBtn.btnAction == Btn.PlayNewGame)
        {
            //needed here other wise would only create menu in next Scene after first left click
            MenuHandler.CREATEMENU = true;
            Application.LoadLevel("Test3");
        }
        else if (currentBtn.btnAction == Btn.ExitGame)
        {
            Application.Quit();
        }
    }
コード例 #3
0
ファイル: UserService.cs プロジェクト: kpinniss/GameSquad
        public List <ApplicationUser> GetTableData(USearch _data)
        {
            var pageCount   = _data.PageCount;
            var username    = _data.Username ?? "";
            var rankFrom    = _data.RankFrom;
            var rankTo      = _data.RankTo;
            var platform    = _data.Platform;
            var currentUser = _data.CurrentUser;

            List <ApplicationUser> data;

            if (_data.OnlineOnly)
            {
                if (_data.LookingFor == "")
                {
                    data = _repo.Query <ApplicationUser>().Where(u => u.UserName.Contains(username) && u.Rank >= rankFrom && u.Rank <= rankTo && u.Platform.Contains(platform) && u.IsOnline == true && u.Id != currentUser).Skip(5 * pageCount).Take(5).ToList();
                }
                else
                {
                    data = _repo.Query <ApplicationUser>().Where(u => u.UserName.Contains(username) && u.Rank >= rankFrom && u.Rank <= rankTo && u.Platform.Contains(platform) && u.IsOnline == true && u.LookingFor.Contains(_data.LookingFor) && u.Id != currentUser).Skip(5 * pageCount).Take(5).ToList();
                }
            }
            else
            {
                if (_data.LookingFor == "")
                {
                    data = _repo.Query <ApplicationUser>().Where(u => u.UserName.Contains(username) && u.Rank >= rankFrom && u.Rank <= rankTo && u.Platform.Contains(platform) && u.Id != currentUser).Skip(5 * pageCount).Take(5).ToList();
                }
                else
                {
                    data = _repo.Query <ApplicationUser>().Where(u => u.UserName.Contains(username) && u.Rank >= rankFrom && u.Rank <= rankTo && u.Platform.Contains(platform) && u.LookingFor.Contains(_data.LookingFor) && u.Id != currentUser).Skip(5 * pageCount).Take(5).ToList();
                }
            }
            return(data);
        }
コード例 #4
0
        public IActionResult Post([FromBody] USearch _data)
        {
            var userId = _manager.GetUserId(User);

            _data.CurrentUser = userId;

            var holder = _service.GetTableData(_data);


            var friends = _fService.GetAllFriendsByUser(userId);

            var rData = new List <FriendCheckReturnVM>();

            foreach (var user in holder)
            {
                var a = new FriendCheckReturnVM {
                    User = user, IsFriend = false
                };
                foreach (var friend in friends)
                {
                    if (user.Id == friend.Id)
                    {
                        a.IsFriend = true;
                    }
                }
                rData.Add(a);
            }

            var value = new { data = rData };

            return(Ok(value));
        }
コード例 #5
0
    /// <summary>
    /// Will find which obj in onScreen List is hovered at the moment
    /// </summary>
    /// <param name="hovering">The transform the mouse is hovering at the moment</param>
    private void Hovering(Transform hovering)
    {
        int counter = 0;

        for (int i = 0; i < onScreen.Count; i++)
        {
            if (onScreen[i] != null)
            {
                if (hovering == onScreen[i].MyTransform.transform)
                {
                    onScreen[i].IsNowHovered = true;

                    Vector3 tipsSpawn = USearch.FindTransfInArray(camChild, "Tips_Spawner").transform.position;
                    SpawnText(Camera.main.WorldToViewportPoint(tipsSpawn));
                }
                else
                {
                    onScreen[i].IsNowHovered = false;
                    counter++;
                }
            }
        }
        //if the counter is being added as many times as the onScreen.Count means tht is nothing hovered at the
        //moment
        if (counter == onScreen.Count)
        {
            DestroyTipMenu();
        }
    }
コード例 #6
0
    public static Sound PlaySoundOneTime(string soundToPlayRoot, Vector3 iniPos = new Vector3(), Transform container = null)
    {
        return(null);

        CamControl mainCam = USearch.FindCurrentCamera();
        Sound      temp    = null;

        if (Settings.ISSoundOn)
        {
            if (iniPos == Vector3.zero)
            {
                iniPos = mainCam.transform.GetComponent <Camera>().transform.position;
            }
            temp = (Sound)General.Create(soundToPlayRoot, iniPos);
        }

        if (container == null)
        {
            temp.transform.SetParent(mainCam.transform.GetComponent <Camera>().transform);
        }
        else
        {
            temp.transform.SetParent(container);
        }

        return(temp);
    }
コード例 #7
0
ファイル: KeepHeight.cs プロジェクト: naaturaz/SM
    // Use this for initialization
    private void Start()
    {
        iniTransf = transform;
        mainCam   = USearch.FindCurrentCamera();

        if (isToKeepDistanceFromCamAndRotateLikeChild)
        {
            difference = mainCam.transform.position - transform.position;
        }
    }
コード例 #8
0
    private new void ActionableBtnClick(Button[] setOfBtns)//actionable buttons
    {
        base.ActionableBtnClick(setOfBtns);

        //when we click in the back to menu main btn in the pause screen
        if (currentBtn.btnAction == Btn.BackToMain)
        {
            int[] slots = { 6, 8 }; //the slots we want to render this obj in the camChild slots
            CloseCurrentMenu(true); //we force to close current menu
            SpawnSetMenu(S.Confirm_Menu_Spawner.ToString(), 150f, slotsP: slots);
            Vector3 msgSpawn = USearch.FindTransfInArray(camChild, "Message_Spawner").transform.position;
            SpawnText(Camera.main.WorldToViewportPoint(msgSpawn), "If you exit will lose all the progress.\n"
                      + "Are you sure you want to exit the game now?");
        }
        //when we click in the ok btn in the pause screen
        else if (currentBtn.btnAction == Btn.OkPause)
        {
            ActionOnPauseBtn();
            Application.LoadLevel("Lobby");
        }
        //when we click in the cancel btn in the pause screen
        else if (currentBtn.btnAction == Btn.CancelPause)
        {
            ActionOnPauseBtn();
            Destroy(textMessage.gameObject);
            textMessage = null;
        }
        //when we click in the SETTINGS btn in the pause screen
        else if (currentBtn.btnAction == Btn.SettingsPause)
        {
            CloseCurrentMenu(true);
            SpawnSetMenu(S.Settings_Pause_Menu_Spawner.ToString());
        }
        //when we click in the MUSIC btn in the settings pause screen
        else if (currentBtn.btnAction == Btn.SwitchMusic)
        {
            ChangeAudioSettings(H.Music.ToString());
        }
        //when we click in the SOUND btn in the settings pause screen
        else if (currentBtn.btnAction == Btn.SwitchSound)
        {
            ChangeAudioSettings(H.Sound.ToString());
        }
        //when we click in the BACK TO PAUSE MENU btn in the settings pause screen
        else if (currentBtn.btnAction == Btn.BackToPauseMenu)
        {
            CloseCurrentMenu(true);
            SpawnSetMenu("Pause_Menu_Spawner", 150f);
        }
        currentBtn = null;
    }
コード例 #9
0
ファイル: UPoly.cs プロジェクト: Cdrix/SM
    /// <summary>
    /// Will ray cast to all obj from active camera will ret the raycast
    /// </summary>
    /// <param name="screenPoint"></param>
    /// <returns></returns>
    public static RaycastHit RayCastAll(Vector2 screenPoint)
    {
        CamControl mainCam  = USearch.FindCurrentCamera();
        RaycastHit HitMouse = new RaycastHit();

        if (Physics.Raycast(mainCam.transform.GetComponent <Camera>().ScreenPointToRay(screenPoint), out HitMouse,
                            Mathf.Infinity))
        {
        }
        else
        {
            //Debug.Log("Mouse Did not Hit any obj UPoly.cs");
        }
        return(HitMouse);
    }
コード例 #10
0
 // Update is called once per frame
 new internal void Update()
 {
     if (isToFollowCamera)
     {
         if (Camera.main != null)
         {
             transform.position = Camera.main.transform.position;
         }
         else
         {
             mainCamera         = USearch.FindCurrentCamera();
             transform.position = mainCamera.transform.position;
         }
     }
 }
コード例 #11
0
ファイル: UPoly.cs プロジェクト: Cdrix/SM
    /// <summary>
    /// Will ray cast to layer , from active camera will ret the raycast
    /// </summary>
    /// <param name="screenPoint"></param>
    /// <returns></returns>
    public static RaycastHit RayCastLayer(Vector2 screenPoint, int layerNumb)
    {
        CamControl mainCam  = USearch.FindCurrentCamera();
        RaycastHit HitMouse = new RaycastHit();

        int layerMask = 1 << layerNumb;

        if (Physics.Raycast(mainCam.transform.GetComponent <Camera>().ScreenPointToRay(screenPoint), out HitMouse,
                            Mathf.Infinity, layerMask))
        {
        }
        else
        {
            //Debug.Log("Mouse Did not Hit Layer:"+layerNumb);
        }
        return(HitMouse);
    }
コード例 #12
0
    public void SubRoutineToFindAllPointsAndPull3dMenu(string menuToPull)
    {
        isCameraMoving = true;                    //camera is moving
        CamControl.CAMFollow.smoothTime = 0.125f; //makes the cam move fast
        //will find the point for this menu

        menuSetShow  = USearch.GetAllTransforms(menuToPull + "_Origin_Points", H.Spawn, H.Tips);
        menuSetSpawn = USearch.IncludeOnlyTransforms(menuToPull + "_Origin_Points", H.Spawn);
        menuSetTip   = USearch.IncludeOnly1Transform(menuToPull + "_Origin_Points", H.Tips);

        menuSetCameraGuide         = USearch.GetAllTransforms(menuToPull + "_Camera_Guide_Points", H.NoSelection);
        menuSetCamGuideNoSelection =
            USearch.IncludeOnly1Transform(menuToPull + "_Camera_Guide_Points", H.NoSelection);

        //Assing TARGET in camera
        CamControl.CAMFollow.target = menuSetCamGuideNoSelection;
        //will spawn menu
        SpawnMenu(menuToPull + "_Spawner", menuSetSpawn, menuSetShow, speedPass: 15f);
    }
コード例 #13
0
    // Use this for initialization
    void Start()
    {
        camera = USearch.FindCurrentCamera();

        Malla     = (Malla)General.Create(Root.malla, container: Program.ClassContainer.transform);
        Poly      = new UPoly();
        subDivide = new SubDivider();
        Vertex    = new Vertexer();
        iniTerr   = new InitializerTerrain();

        iniTerr.Initializer(ref Vertices, ref mesh);
        iniTerr.InitializeMallaStats(Vertices, ref wholeMalla, ref nextStart, ref zLot);

        SubPolyr  = new SubPolyr();
        subMesh   = new SubMeshData();
        IsLoading = true;

        //bz is static and if a new game is started needs to clean up and start again
        CrystalManager1 = new CrystalManager();
    }
コード例 #14
0
ファイル: MenuHandler.cs プロジェクト: naaturaz/SM
    /// <summary>
    /// It finds the single board obj and replace it with the one for the selected character
    /// </summary>
    /// <param name="setOfBtns">The set of buttons passed</param>
    /// <param name="rootP">The obj root will be spawn</param>
    private void SelectPlayerRoutine(Button[] setOfBtns, string rootP)
    {
        int    indexOfSingleB = -1;
        Btn3D  singleBoard    = (Btn3D)USearch.FindBtnInColl(setOfBtns, "SingleBoard", out indexOfSingleB);
        string storeTemp      = singleBoard.gameObject.name;

        moveToPosTemp = singleBoard.MovingToPosition;

        Destroy(singleBoard.gameObject);
        MenuHandler.CREATEMENU = true;
        //Single Board object handlgins
        singleBoard = (Btn3D)CreateBtn(singleBoard, rootP, moveToPosTemp);
        singleBoard.gameObject.name  = storeTemp;
        singleBoard.MovingToPosition = moveToPosTemp;
        //needs to be assign otherwise after being hovered lose movetoPos
        singleBoard.InitialPosition = moveToPosTemp;

        MenuHandler.CREATEMENU = false;
        //asign this back to the array so as is reference the array will hold this new obj now
        setOfBtns[indexOfSingleB] = singleBoard;
    }
コード例 #15
0
ファイル: UPoly.cs プロジェクト: Cdrix/SM
    /// <summary>
    /// Will ray cast to terrain (layer mask 8) from active camera will ret the raycast
    /// </summary>
    /// <param name="screenPoint"></param>
    /// <returns></returns>
    public static RaycastHit RayCastTerrain(Vector2 screenPoint)
    {
        CamControl mainCam = USearch.FindCurrentCamera();

        RaycastHit HitMouseOnTerrain = new RaycastHit();

        // Bit shift the index of the layer (8) to get a bit mask
        // This would cast rays only against colliders in layer 8.
        int layerMask = 1 << 8;

        // Does the ray intersect any objects in the layer 8 "Terrain Layer"
        if (Physics.Raycast(mainCam.transform.GetComponent <Camera>().ScreenPointToRay(screenPoint), out HitMouseOnTerrain,
                            Mathf.Infinity, layerMask))
        {
        }
        else
        {
            //Debug.Log("Mouse Did not Hit Layer 8: Terrain. UPoly.cs");
        }
        return(HitMouseOnTerrain);
    }
コード例 #16
0
ファイル: Player.cs プロジェクト: Cdrix/SM
    //checks if we are hitting something tagged: Spike
    private void CheckIfLoseLive()
    {
        Vector3 rayOrigin = transform.position;

        rayOrigin.y = rayOrigin.y + .4f;

        //Debug.DrawRay(rayOrigin, transform.forward, Color.yellow, 20f);

        RaycastHit hitFront;
        Ray        rayFront = new Ray(rayOrigin, transform.forward);

        if (Physics.Raycast(rayFront, out hitFront))
        {
        }
        if (hitFront.transform != null)
        {
            //print(hitFront.distance + "." + hitFront.transform.name);
            if (hitFront.distance < 0.25f && (hitFront.transform.name.Contains("Spike") ||
                                              hitFront.transform.name.Contains("Mine")))
            {
                if (!graceTime)
                {
                    Lives = TakeOneLiveDamage();
                }
                if (hitFront.transform.name.Contains("Mine"))
                {
                    Mine touchedMine = (Mine)USearch.FindTransfInList(Program.twoDMHandler.allModels, hitFront.transform);
                    if (touchedMine != null)
                    {
                        touchedMine.Explode();
                        touchedMine = null;
                        int indexToRemove = USearch.GiveMeIndexInList(Program.twoDMHandler.allModels, hitFront.transform);
                        Program.twoDMHandler.allModels.RemoveAt(indexToRemove);
                    }
                }
            }
        }
    }