Inheritance: MonoBehaviour
Exemple #1
0
        void OnSelectProfile(PlayerIcon playerIcon)
        {
            int            index          = Array.IndexOf(playerIcons, playerIcon);
            PlayerIconData playerIconData = playerIconDatas[index];

            SelectProfile(playerIconData);
        }
 private void InitPlayerIcon()
 {
     this.m_playerIcon = UnityEngine.Object.Instantiate <PlayerIcon>(this.m_Prefabs.m_PlayerIcon);
     this.m_playerIcon.transform.parent = base.transform;
     TransformUtil.CopyWorld((Component)this.m_playerIcon, (Component)this.m_Bones.m_PlayerIcon);
     SceneUtils.SetLayer(this.m_playerIcon, base.gameObject.layer);
 }
    private GameObject CreatePlayerIcon(PlayerController playerController)
    {
        CharacterInfo charInfo   = playerController.characterInfo;
        PlayerIcon    playerIcon = Instantiate(playerIconPrefab).FindComponent <PlayerIcon>();
        //Image
        Image image = playerIcon.imgCharacterIcon;

        image.color  = playerController.playerColor;
        image.sprite = charInfo.sprite;
        //Char Name
        TMP_Text txtCharName = playerIcon.txtCharacterName;

        txtCharName.text = charInfo.characterName;
        //Player Name
        string   playerName    = PlayerInfo.instance.playerName;
        TMP_Text txtPlayerName = playerIcon.txtPlayerName;

        if (!string.IsNullOrWhiteSpace(playerName))
        {
            txtPlayerName.text = $"({playerName})";
        }
        else
        {
            txtPlayerName.text = $"";
        }
        return(playerIcon.gameObject);
    }
    public void init()
    {
        Vector2 IconLocation = new Vector2(Screen.width / 2f - SizeMaster.opponentSize.x / 2f, Screen.height / 2f - SizeMaster.opponentSize.y / 2f);

        NameField = new Rect(SizeMaster.IndentButtonRight, IconLocation.y + SizeMaster.opponentSize.y * 1.25f, SizeMaster.opponentSize.x, SizeMaster.standardButtonSize.y);
        Rect NameButtonRect   = new Rect(SizeMaster.IndentButtonLeft, NameField.y, SizeMaster.standardButtonSize.x, SizeMaster.standardButtonSize.y);
        Rect IconButtonRect   = new Rect(SizeMaster.IndentButtonLeft, NameButtonRect.y + SizeMaster.SpacingButtonHalf, SizeMaster.standardButtonSize.x, SizeMaster.standardButtonSize.y);
        Rect ColorButtonRect  = new Rect(SizeMaster.IndentButtonRight, IconButtonRect.y, SizeMaster.standardButtonSize.x, SizeMaster.standardButtonSize.y);
        Rect AcceptButtonRect = new Rect(SizeMaster.IndentButtonLeft, ColorButtonRect.y + SizeMaster.SpacingButtonHalf, SizeMaster.standardButtonSize.x, SizeMaster.standardButtonSize.y);
        Rect CancelButtonRect = new Rect(SizeMaster.IndentButtonRight, AcceptButtonRect.y, SizeMaster.standardButtonSize.x, SizeMaster.standardButtonSize.y);

        //Setup playerIcon
        PlayerIcon Icon = new PlayerIcon(gameState.player, IconLocation, assets);

        drawableComponents.Add(Icon);
        DynamicButton Button = new DynamicButton(assets, NameButtonRect, "Update Name", DyanimcButtonStyle.standard, standardTextSize, ChangeProfileName, assets.greenButtonTexture, assets.greenButtonTexture);

        drawableComponents.Add(Button);
        Button = new DynamicButton(assets, IconButtonRect, "Change Icon", DyanimcButtonStyle.standard, standardTextSize, ChangeProfileIcon, assets.greenButtonTexture, assets.greenButtonTexture);
        drawableComponents.Add(Button);
        Button = new DynamicButton(assets, ColorButtonRect, "Change Color", DyanimcButtonStyle.standard, standardTextSize, ChangeProfileColor, assets.greenButtonTexture, assets.greenButtonTexture);
        drawableComponents.Add(Button);
        Button = new DynamicButton(assets, AcceptButtonRect, "Accept", DyanimcButtonStyle.standard, standardTextSize, AcceptProfile, assets.greenButtonTexture, assets.greenButtonTexture);
        drawableComponents.Add(Button);
        Button = new DynamicButton(assets, CancelButtonRect, "Cancel", DyanimcButtonStyle.standard, standardTextSize, Cancel, assets.redButtonTexture, assets.redButtonTexture);
        drawableComponents.Add(Button);

        ProfileName = gameState.player.GetName();
    }
    public EndGameSummaryScreen(BaseScreen prevScreen, List <int> Winners) : base(prevScreen)
    {
        gameOver = assets.gameOverTexture;
        //create ready for next screen button
        Rect temp = new Rect(Screen.width * .5f - SizeMaster.standardButtonSize.x * 0.5f, Screen.height * .6f + SizeMaster.standardButtonSize.y * 2,
                             SizeMaster.standardButtonSize.x, SizeMaster.standardButtonSize.y * 2f);

        readyButton          = new DynamicButton(assets, temp, "return to main menu", DyanimcButtonStyle.playCard, standardTextSize, readyCallBack, assets.playCardIdle, assets.redButtonTexture);
        readyButton.isActive = true;
        leavePlayers();
        //Move winning player to center of screen and set winner by profiles index
        //MoveWinnerToScreenCenter(winner);
        //Move winning players to center of screen and set winner
        float Indent = (Screen.width - SizeMaster.opponentSize.x * Winners.Count) / 2f;

        for (int i = 0; i < Winners.Count; i++)
        {
            PlayerIcon playerIcon = PlayerIcons[Winners[i]];
            if (playerIcon == null)
            {
                continue;
            }
            playerIcon.setPositionToValue(8f);
            playerIcon.setAsWinner(60f);
            playerIcon.setTargetPosition(new Vector2(Indent, SizeMaster.CardsY));
            Indent += SizeMaster.opponentSize.x;
        }
    }
Exemple #6
0
        public void SetPlayersIcons_ValidParameter_PlayersIconsSetCorrectly(PlayerIcon player1Icon, char player1IconStr, char player2IconStr)
        {
            var game = new Game(BoardSize.FiveXFive, player1Icon);

            Assert.False(char.IsWhiteSpace(game.Player1.Icon));
            Assert.False(char.IsWhiteSpace(game.Player2.Icon));
            Assert.Equal(game.Player1.Icon, player1IconStr);
            Assert.Equal(game.Player2.Icon, player2IconStr);
        }
Exemple #7
0
    IEnumerator Coroutine()
    {
        PlayerIcon.StopWebcam();
        Time.timeScale = 0.6f;
        yield return(new WaitForSeconds(3));

        Time.timeScale = 1;
        Pauser.SaveMaterials();
        Application.LoadLevel("DrawFinishScreen");
    }
 private void Awake()
 {
     this.playerIcon = this.playerIconRef.Spawn <PlayerIcon>();
     this.UpdateBackgroundCollider();
     this.inputTextField.maxCharacters = 0x200;
     this.inputTextField.Submitted    += new Action <string>(this.OnInputComplete);
     this.inputTextField.Canceled     += new System.Action(this.OnInputCanceled);
     this.closeButton.AddEventListener(UIEventType.RELEASE, new UIEvent.Handler(this.OnCloseButtonReleased));
     BnetPresenceMgr.Get().AddPlayersChangedListener(new BnetPresenceMgr.PlayersChangedCallback(this.OnPlayersChanged));
 }
Exemple #9
0
    public void addNewPlayerIcon(Profile p)
    {
        float Indent = (Screen.width - SizeMaster.opponentSize.x * (PlayerIcons.Count + 1)) / 2f;

        Vector2    startPos = new Vector2(-(Indent + SizeMaster.opponentSize.x * (gameState.numPlayers() - PlayerIcons.Count * 1.25f)), SizeMaster.opponentsY);
        PlayerIcon icon     = new PlayerIcon(p, startPos, assets);

        icon.setPositionToValue(8f);
        icon.setAsNew(5);
        PlayerIcons.Add(icon);
        adjustPlayerIconPositions();
    }
Exemple #10
0
    private void SetCurrentMatchup(Matchup matchup)
    {
        PlayersManager.currentLeftPlayer = matchup.leftPlayer;
        currentLeftPlayer = medleyManager.GetPlayerAt(matchup.leftPlayer);
        leftPlayerIcon.Init(currentLeftPlayer.title, currentLeftPlayer.score, currentLeftPlayer.color);

        PlayersManager.currentRightPlayer = matchup.rightPlayer;
        currentRightPlayer = medleyManager.GetPlayerAt(matchup.rightPlayer);
        rightPlayerIcon.Init(currentRightPlayer.title, currentRightPlayer.score, currentRightPlayer.color);

        currentMinigame    = GetRandomMinigame();
        minigameTitle.text = currentMinigame.minigameName;
    }
Exemple #11
0
        // Layout with current profiles
        void Setup()
        {
            ActivatePlayerIcons(true);
            if (playerIconDatas == null)
            {
                playerIconDatas = ProfileManager.GetPlayersIconData();
            }
            int totProfiles = playerIconDatas == null ? 0 : playerIconDatas.Count;
            int len         = playerIcons.Length;

            for (int i = 0; i < len; ++i)
            {
                PlayerIcon playerIcon = playerIcons[i];
                if (i >= totProfiles)
                {
                    playerIcon.gameObject.SetActive(false);
                }
                else
                {
                    PlayerIconData iconData = playerIconDatas[i];
                    playerIcon.gameObject.SetActive(true);
                    playerIcon.Init(iconData);

                    // Use the first available, if the player is null
                    if (AppManager.I.Player == null)
                    {
                        AppManager.I.PlayerProfileManager.SetPlayerAsCurrentByUUID(playerIcon.Uuid);
                    }

                    playerIcon.Select(AppManager.I.Player.Uuid);
                    playerIcon.transform.localScale = Vector3.one * (AppManager.I.Player.Uuid == playerIcon.Uuid ? 1.14f : 1);
                }
            }

            if (totProfiles == 0)
            {
                BtAdd.Pulse();
                BtPlay.StopPulsing();
                btPlayTween.PlayBackwards();
            }
            else
            {
                // Set play button position
                this.StartCoroutine(CO_SetupPlayButton());
            }
            if (totProfiles >= maxProfiles)
            {
                btAddTween.Rewind();
                BtAdd.gameObject.SetActive(false);
            }
        }
Exemple #12
0
        // Used to set play button position after one frame, so grid is set correctly
        IEnumerator CO_SetupPlayButton()
        {
            yield return(null);

            BtPlay.gameObject.SetActive(true);
            // PLAYER REFACTORING WITH UUID
            PlayerIcon activePlayerIcon = GetPlayerIconByUUID(AppManager.I.Player.Uuid);

            if (activePlayerIcon != null)
            {
                BtPlay.RectT.SetAnchoredPosX(activePlayerIcon.UIButton.RectT.anchoredPosition.x);
            }
            btPlayTween.PlayForward();
        }
Exemple #13
0
    // Use this for initialization
    void Awake()
    {
        rb       = GetComponent <Rigidbody2D>();
        col      = GetComponent <BoxCollider2D>();
        animator = GetComponent <Animator>();
        xScale   = Mathf.Abs(transform.localScale.x);
        icon     = playerIcon.GetComponent <PlayerIcon>();
        icon.SetPlayerNumber(playerNumber);

        if (direction == 0)
        {
            direction = 1;
        }
    }
Exemple #14
0
        void ReleaseDesignerOutlets()
        {
            if (AlbumArtView != null)
            {
                AlbumArtView.Dispose();
                AlbumArtView = null;
            }

            if (BlurOverlay != null)
            {
                BlurOverlay.Dispose();
                BlurOverlay = null;
            }

            if (TrackName != null)
            {
                TrackName.Dispose();
                TrackName = null;
            }

            if (ArtistName != null)
            {
                ArtistName.Dispose();
                ArtistName = null;
            }

            if (InstrumentalTag != null)
            {
                InstrumentalTag.Dispose();
                InstrumentalTag = null;
            }

            if (PlayerIcon != null)
            {
                PlayerIcon.Dispose();
                PlayerIcon = null;
            }

            if (ThumbnailView != null)
            {
                ThumbnailView.Dispose();
                ThumbnailView = null;
            }

            if (SettingsButton != null)
            {
                SettingsButton.Dispose();
                SettingsButton = null;
            }
        }
Exemple #15
0
    // Use this for initialization
    void Awake()
    {
        rb       = GetComponent <Rigidbody2D>();
        col      = GetComponent <BoxCollider2D>();
        animator = GetComponent <Animator>();
        zScale   = Mathf.Abs(transform.localScale.z);
        icon     = playerIcon.GetComponent <PlayerIcon>();
        icon.SetPlayerNumber(playerNumber);
        //device = InputManager.Devices[playerNumber - 1];

        if (direction == 0)
        {
            direction = 1;
        }
    }
Exemple #16
0
        private GameObject Construct(Player p)
        {
            GameObject obj;

            if (FFB.Instance.Settings.Graphics.AbstractIcons)
            {
                obj = PlayerIcon.GeneratePlayerIconAbstract(p, AbstractIconPrefab);
            }
            else
            {
                obj = PlayerIcon.GeneratePlayerIcon(p, PlayerIconPrefab, AbstractIconPrefab);
            }
            obj.transform.SetParent(Field.transform);
            return(obj);
        }
Exemple #17
0
        private void _playerManager_PlayerUpdated(object sender, Player player)
        {
            try
            {
                PlayerIcon playerIcon = _playerIcons.Find(icon => icon.Id == player.Id);
                float      fade       = player.LowHealth ? 0.2f : 0;
                playerIcon.Icon.PFade = fade;

                Predicate <DebuffObj> debuffed = obj => obj.Id == player.Id;
                foreach (var obj in _debuffObjects.FindAll(debuffed))
                {
                    obj.D3DObject.Visible = false;
                    obj.D3DObject.Dispose();
                    _debuffObjects.Remove(obj);
                }

                int index = 0;
                foreach (DebuffInformation info in player.Debuffs)
                {
                    int spell = info.Spell;
                    if (info.MapDebuffToIcon(spell) != null && WorldObjectService.IsValidObject(player.Id))
                    {
                        int    icon = (int)info.MapDebuffToIcon(spell);
                        D3DObj obj  = CoreManager.Current.D3DService.MarkObjectWithIcon(player.Id, icon);
                        float  dz   = _globals.Host.Actions.Underlying.ObjectHeight(player.Id) + ((float)0 * 0.5f);
                        obj.Scale(0.5f);
                        obj.Anchor(player.Id, 0.2f, 0.0f, 0.0f, dz);
                        obj.PBounce   = 0.0f;
                        obj.Autoscale = false;
                        obj.HBounce   = 0.0f;
                        obj.OrientToCamera(true);
                        obj.POrbit = 2f;
                        obj.ROrbit = 0.5f;
                        obj.AnimationPhaseOffset = index * ((2f / 8f));
                        obj.Visible = true;
                        DebuffObj debuffObj = _debuffObjFactory(
                            player.Id,
                            info.Spell,
                            icon,
                            obj);

                        _debuffObjects.Add(debuffObj);
                        ++index;
                    }
                }
            } catch (Exception ex) { _logger.Error(ex); }
        }
Exemple #18
0
 public void ImageListInit()
 {
     for (int i = 0; i < iconList.Count; i++)
     {
         PlayerIcon playerIconClone = Instantiate(this.PlayerIcon, imageListHorizontal.transform);
         playerIconClone.iconImage.sprite = iconList[i];
         var icon = iconList[i];
         playerIconClone.iconButton.onClick.AddListener((UnityEngine.Events.UnityAction)(() =>
         {
             Debug.Log("Herpderp" + i.ToString());
             playerEntry.SetPlayerIcon(icon);
             RefreshHighlightedImages();
         }));
         playerIconList.Add(playerIconClone);
     }
     RefreshHighlightedImages();
 }
Exemple #19
0
        public void SetPlayersIcons(PlayerIcon player1Icon)
        {
            switch (player1Icon)
            {
            case PlayerIcon.PlayerX:
                _player1.Icon = 'X';
                _player2.Icon = 'O';
                break;

            case PlayerIcon.PlayerO:
                _player1.Icon = 'O';
                _player2.Icon = 'X';
                break;

            default:
                break;
            }
        }
Exemple #20
0
        public void Draw(SpriteBatch Target)
        {
            Br.Draw(Target);
            Vs.Draw(Target);
            Cardchoose.Draw(Target);
            ChooseText.Draw(Target);
            ChooseConfirm.Draw(Target);
            ChooseOrderText.Draw(Target);

            UI_Bottom.Draw(Target);
            UI_BottomLeft.Draw(Target);
            UI_Up.Draw(Target);
            UI_UpRight.Draw(Target);
            UI_UpLeft.Draw(Target);

            EnemyTurnSprite.Draw(Target);
            EnemyTurnText.Draw(Target);
            NewTurnText.Draw(Target);

            PlayerIcon.Draw(Target);
            OpponentIcon.Draw(Target);
            PlayerName.Draw(Target);
            OpponentName.Draw(Target);
            PlayerPoints.Draw(Target);
            OpponentPoints.Draw(Target);
            PlayerMoney.Draw(Target);
            RoundTime.Draw(Target);

            foreach (var cp in CPInfos)
            {
                cp.Draw(Target);
            }

            TileName.Draw(Target);
            Btn_Move.Draw(Target);
            Btn_Attack.Draw(Target);
            Btn_EndTurn.Draw(Target);
            Btn_Stats.Draw(Target);
            Btn_GameMenu.Draw(Target);
            Btn_Chat.Draw(Target);
            Inf.Draw(Target);

            EndGame.Draw(Target);
        }
Exemple #21
0
    void Start()
    {
        musicSource.playOnAwake = true;
        musicSource.PlayOneShot(music);


        Profile player = new Profile("player", 0, 0, assets);

        gameState        = new GameState();
        gameState.player = player;
        assets.LoadAll();



        Profile t = new Profile("tim", 0, 0, assets);

        testIcon = new PlayerIcon(t, new Vector2(0, Screen.height * .5f), assets);
        testIcon.setAsWinner(15);
        testIcon.setAsNew(15);

        /*gameState.addPlayCard(1);
         * gameState.addPlayCard(2);
         * gameState.addPlayCard(3);
         * gameState.addPlayCard(3);
         * gameState.addPlayCard(3);
         * gameState.setSituationCardIndex(3);
         * gameState.addVoteCard(1);
         * gameState.addVoteCard(2);
         * gameState.addVoteCard(3);
         *
         * Profile op1 = new Profile("timmy", 1, 0);
         * gameState.addPlayer(op1);
         * op1 = new Profile("timmy", 1, 0);
         * gameState.addPlayer(op1); gameState.addPlayer(op1); gameState.addPlayer(op1);
         */


        content       = new GUIContent();
        network       = new NetworkManager();
        currentScreen = new MainScreen(network, assets, gameState);
        // currentScreen = new VoteCardScreen(currentScreen);
        //currentScreen = new PlayCardScreen(currentScreen);
    }
Exemple #22
0
        private void _processPlayerRemove(Player player)
        {
            PlayerIcon playerIcon = _playerIcons.Find(icon => icon.Id == player.Id);

            if (playerIcon != null)
            {
                playerIcon.Icon.Dispose();
            }

            _playerIcons.Remove(playerIcon);
            HudList playersView = player.Enemy ? _enemyListView : _friendlyListView;

            for (int i = 0; i < playersView.RowCount; i++)
            {
                HudStaticText name = (HudStaticText)playersView[i][1];
                if (name.Text == player.Name)
                {
                    playersView.RemoveRow(i);
                }
            }
        }
Exemple #23
0
    private void SetPlayers()
    {
        int quantity = playerScores.Count;

        players = new List <PlayerIcon>();

        for (int i = 0; i < quantity; i++)
        {
            GameObject _object = Instantiate(playerPrefab, playersLayout);
            PlayerIcon icon    = _object.GetComponent <PlayerIcon>();
            if (icon)
            {
                Color color = (i < playerColors.Length) ? playerColors[i] : Color.black;
                icon.Init("Player " + i, playerScores[i], color);
            }
            players.Add(icon);
        }


        playerPrefab.SetActive(false);
        playing = true;
    }
Exemple #24
0
        void Start()
        {
            // By default, the letter shows a truly random letter
            LLInStage.Init(AppManager.I.Teacher.GetRandomTestLetterLL(useMaxJourneyData: true));

            Setup();

            btAddTween = BtAdd.transform.DORotate(new Vector3(0, 0, -45), 0.3f).SetAutoKill(false).Pause()
                         .SetEase(Ease.OutBack)
                         .OnRewind(() => {
                if (AppManager.I.PlayerProfileManager.GetPlayersIconData() == null ||
                    AppManager.I.PlayerProfileManager.GetPlayersIconData().Count == 0)
                {
                    BtAdd.Pulse();
                }
            });
            btPlayTween = DOTween.Sequence().SetAutoKill(false).Pause()
                          .Append(BtPlay.RectT.DOAnchorPosY(-210, 0.2f).From(true))
                          .OnPlay(() => BtPlay.gameObject.SetActive(true))
                          .OnRewind(() => BtPlay.gameObject.SetActive(false))
                          .OnComplete(() => BtPlay.Pulse());

            BtPlay.gameObject.SetActive(false);

            // Listeners
            BtAdd.Bt.onClick.AddListener(() => OnClick(BtAdd));
            BtPlay.Bt.onClick.AddListener(() => {
                AudioManager.I.PlaySound(Sfx.UIButtonClick);
                HomeScene.Play();
            });
            foreach (PlayerIcon pIcon in playerIcons)
            {
                PlayerIcon p = pIcon;
                p.UIButton.Bt.onClick.AddListener(() => OnSelectProfile(p));
            }
        }
 private void DrawWaitingIcon(PlayerIcon icon)
 {
     icon.WaitingIcon.draw(Game1.spriteBatch);
 }
 private void DrawOfflineIcon(PlayerIcon icon)
 {
     icon.OfflineIcon.draw(Game1.spriteBatch);
 }
Exemple #27
0
 private void Awake()
 {
     instance = this;
 }
Exemple #28
0
 public Game(BoardSize boardSize, PlayerIcon player1Icon)
 {
     _board = CreateGameBoard(boardSize);
     SetPlayersIcons(player1Icon);
 }
 public void SetIcon(PlayerIconData data)
 {
     _iconType = data.Type;
     Icon.SetImage(data.Icon);
 }
 public PlayerRow(int index, int rank, Player player, string status, string crewTag, PlayerIcon icon, HudColor rowColor, HudColor statusColor)
 {
     this.RowIndex    = index;
     this.PlayerRank  = rank;
     this.Player      = player;
     this.Status      = status;
     this.CrewTag     = crewTag;
     this.Icon        = icon;
     this.RowColor    = rowColor;
     this.StatusColor = statusColor;
 }