Ejemplo n.º 1
0
        private void ShowSyncConflict()
        {
            this.labelTitle.Text = this.lang.Get("ACCOUNT_SYNC", new object[0]);
            this.labelBody.Text  = this.lang.Get("ACCOUNT_SYNC_CONFLICT", new object[]
            {
                this.accountProvider,
                this.accountProvider
            });
            this.labelAccountTitle.Text = this.lang.Get("ACCOUNT_SYNC_EXISTING_SYNCED", new object[]
            {
                this.accountProvider
            });
            int lastSyncedTimeStamp = this.command.ResponseResult.LastSyncedTimeStamp;

            if (lastSyncedTimeStamp > 0)
            {
                DateTime dateTime = DateUtils.DateFromSeconds(lastSyncedTimeStamp);
                this.labelLastSynced.Text = this.lang.Get("ACCOUNT_SYNC_LAST_DATE", new object[]
                {
                    dateTime.get_Month(),
                    dateTime.get_Day(),
                    dateTime.get_Year()
                });
                this.labelLastSynced.Visible = true;
            }
            else
            {
                this.labelLastSynced.Visible = false;
            }
            this.buttonLoad.Visible              = true;
            this.buttonLoad.OnClicked            = new UXButtonClickedDelegate(this.OnSyncConflictLoadExistingClicked);
            this.buttonConnectNew.Visible        = true;
            this.buttonConnectNew.OnClicked      = new UXButtonClickedDelegate(this.OnSyncConflictConnectNewClicked);
            this.buttonOk.Visible                = false;
            this.buttonCancel.Visible            = false;
            this.buttonConnectNewConfirm.Visible = false;
            PlayerIdentityInfo       playerIdentityInfo              = null;
            PlayerIdentityInfo       playerIdentityInfo2             = null;
            PlayerIdentityController playerIdentityController        = Service.Get <PlayerIdentityController>();
            Dictionary <string, PlayerIdentityInfo> playerIdentities = this.command.ResponseResult.PlayerIdentities;

            foreach (PlayerIdentityInfo current in playerIdentities.Values)
            {
                if (playerIdentityController.IsFirstIdentity(current.PlayerId))
                {
                    playerIdentityInfo = current;
                }
                else
                {
                    playerIdentityInfo2 = current;
                }
            }
            if (playerIdentityInfo2 != null)
            {
                this.PopulatePlayerInfo(AccountSyncAccountType.MultipleAccountsPrimary, playerIdentityInfo.PlayerName, playerIdentityInfo.HQLevel, playerIdentityInfo.Medals, playerIdentityInfo.Faction, playerIdentityInfo.SquadName);
                this.PopulatePlayerInfo(AccountSyncAccountType.MultipleAccountsSecondary, playerIdentityInfo2.PlayerName, playerIdentityInfo2.HQLevel, playerIdentityInfo2.Medals, playerIdentityInfo2.Faction, playerIdentityInfo2.SquadName);
                return;
            }
            this.PopulatePlayerInfo(AccountSyncAccountType.SingleAccount, playerIdentityInfo.PlayerName, playerIdentityInfo.HQLevel, playerIdentityInfo.Medals, playerIdentityInfo.Faction, playerIdentityInfo.SquadName);
        }
Ejemplo n.º 2
0
    void TargetEndGame(NetworkConnection conn, bool success, bool didWin, int playerIfWon)
    {
        if (!gameOver)
        {
            gameOver = true;

            if (success)
            {
                //find winning player
                Sprite winSprite = null;
                string winName   = "Unknown";
                foreach (GameObject p in GameObject.FindGameObjectsWithTag("Player"))
                {
                    PlayerIdentityController pid  = p.GetComponent <PlayerIdentityController>();
                    LocalPlayerIdentity      lpid = p.GetComponent <LocalPlayerIdentity>();

                    int UID = pid ? pid.UID : lpid.UID;

                    if (UID == playerIfWon)
                    {
                        winName   = pid ? pid.name : lpid.name;
                        winSprite = p.GetComponent <SpriteRenderer>().sprite;
                        break;
                    }
                }

                print("Boss died, player wins: " + playerIfWon);

                //we know name and sprite, set it
                endGameWinnerText.text    = string.Format("Winner!\n{0}", winName);
                endGameWinnerImage.sprite = winSprite;

                //display appropriate salute depending on if we won or not
                if (didWin)
                {
                    endGameSalute.text = "Congratulations, noble dwarf.\n\nYou have bested the dungeon and your traitorous kin.\nReturn now, live in luxury, and enjoy your honor!";
                }
                else
                {
                    endGameSalute.text = "Feeble dwarf, you have been dishonored.\n\nYou will return a broken dwarf, or stay to haunt these halls forever.\nSuch is the fate of a weak dwarf.";
                }

                endGameHud.gameObject.SetActive(true);
                menuButton.Select();
            }
            else
            {
                //boss did not die, everyone else did, simply keep the base text and present the menu
                endGameHud.gameObject.SetActive(true);
            }
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Links a gameobject with a particular ID
    /// </summary>
    /// <param name="player">The game object to link</param>
    /// <param name="ID">That player's connection ID</param>
    public void LinkObjectToID(GameObject player, int ID)
    {
        playerMap.Add(ID, player);
        PlayerIdentityController identity      = player.GetComponent <PlayerIdentityController>();
        LocalPlayerIdentity      localIdentity = player.GetComponent <LocalPlayerIdentity>();

        if (identity)
        {
            identity.playerAnimIndex = playerMap.Keys.Count - 1;
            string name = playerNames.Count > 0 ? playerNames[Random.Range(0, playerNames.Count)] : "Player " + playerMap.Keys.Count;
            identity.name = name;
            identity.UID  = ID;
        }
        else
        {
            localIdentity.playerAnimIndex = playerMap.Keys.Count - 1;
            localIdentity.name            = "Player 2";
            localIdentity.UID             = ID;
        }

        MultiplayerRunManager.Instance.numPlayers = playerMap.Keys.Count;
    }