コード例 #1
0
ファイル: ServerInfos.cs プロジェクト: Nakou/UDynNet
	public void NewPlayer(string name){
		if(playerList == null){
			playerList = new SyncListString();
		}
		playerList.Add(name);
		playerCount = playerList.Count;
	}
コード例 #2
0
    private void DrawCardIfPossible(SyncListString hand, List <string> deck, CardType?specificType = null)
    {
        if (deck.Count == 0)
        {
            return;
        }

        if (hand.Count >= Constants.MaxHandSize)
        {
            return;
        }

        for (int i = 0; i < deck.Count; ++i)
        {
            var card = deck[i];

            CardDesc cardDesc;
            if (!CardDB.Instance.Cards.TryGetValue(card, out cardDesc))
            {
                continue;
            }

            if (specificType == null || cardDesc.Type == specificType.Value)
            {
                deck.RemoveAt(i);
                hand.Add(card);
                return;
            }
        }
    }
コード例 #3
0
ファイル: StreamingList.cs プロジェクト: Sergyl/WarField
    // Ésta función crea botones con el nombre de las salas activas.
    private void CreateButtons()
    {
        // Buscará el GameObject CallManager en la escena. Ya que es el encargado de gestionar el tema de los nombres de los jugadores que tienen o no abierta una sala de streaming.
        GameObject CallManager = GameObject.FindGameObjectWithTag("CallManager");
        // Mediante la función GetListFree creada en el script CallManager del GameObject del mismo nombre, se obtiene una lista de nombres correspondientes a los jugadores que tienen una sala activada.
        SyncListString namesFree = CallManager.GetComponent <CallManager>().GetListFree();

        // Mediante este bucle for, se añade a cada jugador con su sala abierta, una posición en la lista de streaming abiertos.
        for (int i = 0; i < namesFree.Count; i++)
        {
            // Si el nombre obtenido de la lista, no es el propio, no aparecerá en la lista (ya que no tiene sentido meterse en una sala de streaming que ha creado uno mismo)
            if (!namesFree.Contains(selfPlayer.GetComponent <PlayerCode>().GetName()))
            {
                // Crea un botón con la una de las posiciones de los vectores inicializados anteriormente.
                buttons[i] = (GameObject)Instantiate(Button, SpawnButton[i], Quaternion.identity);
                // Asigna la posición del vector de manera relativa a la posición de la lista dentro de la lista de streaming activos
                buttons[i].transform.SetParent(StreamingPanel.transform, false);
                // Muestra el botón
                buttons[i].SetActive(true);
                // El botoón tendrá el nombre del jugador que ha creado la sala. De modo que si se presione sobre ese bótón, la función que realizará la entrada a la sala
                // recibirá como parámetro de entrada el nombre del botón. Ya que, a la hora de crear las salas de streaming, estas se crean un nombre que las identifica de las demas. Este nombre no es otro que el nombre del jugador que crea la sala
                GameObject name = buttons[i].transform.Find("Nombre").gameObject;
                name.GetComponent <UnityEngine.UI.Text>().text = namesFree[i].ToString();
            }
        }
    }
コード例 #4
0
ファイル: StreamingList.cs プロジェクト: Sergyl/WarField
    public void Update()
    {
        // Mediante esta función la lista de streaming activos se actualizará incluso cuando esté abierta. De modo que en el momento de abrirla si alguna sala se cierra
        // por alguna razón, desaparecerá su botón correspondiente de la lista automáticamente.

        // Si la lista de streaming está abierta.....
        if (StreamingPanel.activeSelf)
        {
            // Se hace una comprobación de los nombres de los jugadores que tienen abierta su sala.
            GameObject     CallManager = GameObject.FindGameObjectWithTag("CallManager");
            SyncListString namesFree   = CallManager.GetComponent <CallManager>().GetListFree();
            for (int i = 0; i < buttons.Length; i++)
            {
                if (buttons[i] != null)
                {
                    nombre = buttons[i].transform.Find("Nombre").gameObject;
                    // Si el nombre de algún jugador de la lista ya no se encuentra dentro de la variable namesFree, desaparecerá su botón.
                    if (!namesFree.Contains(nombre.GetComponent <UnityEngine.UI.Text>().text))
                    {
                        Destroy(buttons[i]);
                    }
                }
            }
        }
    }
コード例 #5
0
    public void GenerateDeck()
    {
        SyncListString newDeck = new SyncListString();

        foreach (string s in suits)
        {
            foreach (string v in values)
            {
                newDeck.Add(s + v);
            }
        }
        newDeck.Add("J1");
        newDeck.Add("J2");
        System.Random random = new System.Random();
        int           n      = newDeck.Count;

        while (n > 1)
        {
            int k = random.Next(n);
            n--;
            string temp = newDeck[k];
            newDeck[k] = newDeck[n];
            newDeck[n] = temp;
        }
        deck = newDeck;
    }
コード例 #6
0
 public static void WriteInstance(NetworkWriter writer, SyncListString items)
 {
     writer.Write((ushort)items.Count);
     foreach (string item in items)
     {
         writer.Write(item);
     }
 }
コード例 #7
0
    void Awake()
    {
        //players = new SyncListString();

        //if (!isServer)
        //return;

        namesList = new SyncListString();
    }
コード例 #8
0
    //To do:

    /*
     */

    //Compares a player inventory list with the shopping list
    public int CompareLists(List <string> shopping)
    {
        SyncListString i = GetComponent <PlayerResources>().GetInventory();

        foreach (string s in i)
        {
            Debug.Log("inventory: " + s);
        }
        return(0);
    }
コード例 #9
0
        public static SyncListString ReadInstance(NetworkReader reader)
        {
            ushort         num            = reader.ReadUInt16();
            SyncListString syncListString = new SyncListString();

            for (ushort num2 = 0; num2 < num; num2 = (ushort)(num2 + 1))
            {
                syncListString.AddInternal(reader.ReadString());
            }
            return(syncListString);
        }
コード例 #10
0
        public void SetUp()
        {
            serverSyncList = new SyncListString();
            clientSyncList = new SyncListString();

            // add some data to the list
            serverSyncList.Add("Hello");
            serverSyncList.Add("World");
            serverSyncList.Add("!");
            SerializeAllTo(serverSyncList, clientSyncList);
        }
コード例 #11
0
 private void OnChatUpdated(SyncListString.Operation op, int index)
 {
     chatline.text += chatLog[chatLog.Count - 1] + "\n";
     
     if(chatPanel.activeSelf == false) {
         chatPanel.SetActive(true);
         state = 1;
     }
     // reset the wait timer
     timer = amountOfWaitTime;
 }
コード例 #12
0
    void Awake()
    {
        renderers   = GetComponentsInChildren <Renderer>();
        maxHealth   = 200;
        healthRegen = 0.1f;
        maxMana     = 100;
        health      = 100;
        mana        = 100;
        attackDamge = 10;
        armour      = 10;
        money       = 100;
        speed       = 3.5f;

        healthBarHUD = GameObject.Find("HealthHUD").GetComponent <Transform>();
        healthText   = GameObject.Find("HealthText").GetComponent <Text>();
        manaBarHUD   = GameObject.Find("ManaHUD").GetComponent <Transform>();
        manaText     = GameObject.Find("ManaText").GetComponent <Text>();
        moneyText    = GameObject.Find("MoneyText").GetComponent <Text>();

        hitScreen         = GameObject.Find("HitScreen").GetComponent <Image>();
        hitScreen.enabled = true;
        hitScreenColour   = hitScreen.color;

        namesList = new SyncListString();

        spawnPoint = transform.position;

        tabCanvas         = GameObject.Find("TabCanvas").GetComponent <Canvas>();
        tabCanvas.enabled = false;

        gManager = GameObject.Find("Server").GetComponent <GameManager>();

        if (isAI)
        {
            gManager.playerList.Add("AI player");
        }
        else
        {
            gManager.playerList.Add("Player");
        }

        if (!isAI)
        {
            myCamera.GetComponent <CameraController>().SetPlayer(transform);
            myCamera.name = "PlayerCamera(Clone)";
        }

        if (!isLocalPlayer)
        {
            //Destroy(myCamera);
        }

        SetTeam(1);
    }
コード例 #13
0
ファイル: PlayerManager.cs プロジェクト: deliav04/GolfGame
    public override void OnStartClient()
    {
        base.OnStartClient();


        Background  = GameObject.Find("Background");
        Discard     = GameObject.Find("Discard");
        startButton = GameObject.Find("StartButton");
        mainCanvas  = GameObject.Find("Main Canvas");
        GameManager = GameObject.Find("GameManager").GetComponent <GameManager>();


        deck = GameManager.deck;
    }
コード例 #14
0
    public override void OnDeserialize(NetworkReader reader, bool initialState)
    {
        if (initialState)
        {
            SyncListString.ReadReference(reader, this.list);
            return;
        }
        int num = (int)reader.ReadPackedUInt32();

        if ((num & 1) != 0)
        {
            SyncListString.ReadReference(reader, this.list);
        }
    }
コード例 #15
0
 public static bool Implied(String exp, SyncListString Inv, String InvJS)
 {
     try
     {
         //Creates the HTTP request
         HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
         request.Method      = "POST";
         request.ContentType = "application/json";
         //Get the proper JSON string for the request (every time you call this method it will ask for the next level)
         String Arg0 = "";
         foreach (String S in Inv)
         {
             Arg0 += S + ",";
         }
         Arg0 = Arg0.Substring(0, Arg0.Length - 1);
         String formatter = "{{\"jsonrpc\":\"2.0\",\"method\":\"App.impliedPairs\",\"params\":[[{0}],[{1}],{2},[\"Anonymous\",null,\"facebook\"]],\"id\":{3}}}";
         string reqData   = string.Format(formatter, Arg0, exp, InvJS, requestCounter++);
         request.ContentLength = reqData.Length;
         //This cookie simulated having logged in with facebook. If you really logged in the web browser would set the FBID to the facebook ID of the user
         CookieContainer cookies = new CookieContainer(1);
         cookies.Add(new Cookie("FBID", "Anonymous", "/api", "invgame.azurewebsites.net"));
         request.CookieContainer = cookies;
         //Write the request string to the network (basically sends the request to the server)
         StreamWriter requestWriter = new StreamWriter(request.GetRequestStream(), System.Text.Encoding.ASCII);
         requestWriter.Write(reqData);
         requestWriter.Close();
         //Read the response from the server (by simulating the Facebook login with the cooke we should not get errors
         WebResponse  webResponse    = request.GetResponse();
         Stream       webStream      = webResponse.GetResponseStream();
         StreamReader responseReader = new StreamReader(webStream);
         //Read the response body (a JSON string) to the response string. This is the string to parse for the level
         string response = responseReader.ReadToEnd();
         //Debug.Log(response);
         responseReader.Close();
         if (ToSimplify(response) != "[]")
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception e)
     {
         Debug.Log("-----------------");
         Debug.Log(e.Message);
         return(true);
     }
 }
コード例 #16
0
        public void ObjectCanBeReusedAfterReset()
        {
            clientSyncList.Reset();

            // make old client the host
            SyncListString hostList    = clientSyncList;
            SyncListString clientList2 = new SyncListString();

            Assert.That(hostList.IsReadOnly, Is.False);

            // Check Add and Sync without errors
            hostList.Add("hello");
            hostList.Add("world");
            SerializeDeltaTo(hostList, clientList2);
        }
コード例 #17
0
ファイル: Chat.cs プロジェクト: Adderbane/OVWS-Scavenger-Hunt
 //callback we registered for when the syncList changes
 private void OnChatUpdated(SyncListString.Operation op, int index)
 {
     //Checks the teambit and only posts if appropriate
     string newMessage = chatLog [chatLog.Count - 1] + "\n";
     if (newMessage.Substring(0,1) == "a") {
         newMessage = newMessage.Remove(0,1);
         newMessage = "[All] " + newMessage;
         chatWindow.text += newMessage;
     }
     else if (team.Substring(0,1) == newMessage.Substring(0,1)) {
         newMessage = newMessage.Remove(0,1);
         newMessage = "[Team] " + newMessage;
         chatWindow.text += newMessage;
     }
 }
コード例 #18
0
ファイル: UpdateSprite.cs プロジェクト: deliav04/GolfGame
    public static SyncListString CreateDeck()
    {
        SyncListString newDeck = new SyncListString();

        foreach (string s in suits)
        {
            foreach (string v in values)
            {
                newDeck.Add(s + v);
            }
        }
        newDeck.Add("J1");
        newDeck.Add("J2");
        return(newDeck);
    }
コード例 #19
0
ファイル: Player.cs プロジェクト: lfrankel/GGJ2017
    public void Awake()
    {
        m_hand       = new SyncListString();
        m_candidates = new SyncListString();
        //add 4 empty items
        if (!isLocalPlayer)
        {
            while (m_hand.Count < m_handSize)
            {
                m_hand.Add("");
            }

            while (m_hand.Count < m_candidateSize)
            {
                m_candidates.Add("");
            }
        }
    }
コード例 #20
0
ファイル: PlayerManager.cs プロジェクト: deliav04/GolfGame
    public void CmdDrawCard()
    {
        if (isServer)
        {
            if (connectionToClient == GameManager.CurrPlayer && !GameManager.NewCardFlipped)
            {
                GameManager.deck.Callback += DeckChanged;
                deck = GameManager.deck;

                TargetDeselectCard(connectionToClient);

                GameObject newCard = Instantiate(CardPrefab, new Vector3(0, 0, 0), Quaternion.identity);
                newCard.GetComponent <Selectable>().faceUp = true;
                newCard.name = deck.Last <string>();
                NetworkServer.Spawn(newCard);
                newCard.transform.SetParent(Discard.transform, false);
                RpcDrawCard(newCard, deck.Last <string>());
                GameManager.UpdateDeck();
                GameManager.NewCardFlipped = true;
            }
        }
    }
コード例 #21
0
    public override bool OnSerialize(NetworkWriter writer, bool forceAll)
    {
        if (forceAll)
        {
            SyncListString.WriteInstance(writer, this.list);
            return(true);
        }
        bool flag = false;

        if ((base.syncVarDirtyBits & 1u) != 0u)
        {
            if (!flag)
            {
                writer.WritePackedUInt32(base.syncVarDirtyBits);
                flag = true;
            }
            SyncListString.WriteInstance(writer, this.list);
        }
        if (!flag)
        {
            writer.WritePackedUInt32(base.syncVarDirtyBits);
        }
        return(flag);
    }
コード例 #22
0
ファイル: PlayerManager.cs プロジェクト: deliav04/GolfGame
    void RestartRound()
    {
        RpcUnhighlightAll();
        RpcReset();

        GameObject[] areas = GameObject.FindGameObjectsWithTag("PlayerArea");

        foreach (GameObject area in areas)
        {
            foreach (Transform card in area.transform)
            {
                Destroy(card.gameObject);
            }
        }

        foreach (Transform card in Discard.transform)
        {
            Destroy(card.gameObject);
        }

        Debug.Log("Old Cards Destroyed");

        Debug.Log("Areas to remove: " + PlayersRemoved.Count);
        foreach (int toRemove in PlayersRemoved)
        {
            areas[toRemove].transform.parent.gameObject.SetActive(false);
            int thisPlayer = 0;
            foreach (NetworkConnection conn in GameManager.PlayerConnections)
            {
                if (conn != null)
                {
                    TargetRemoveArea(conn, toRemove, thisPlayer);
                    thisPlayer++;
                }
            }
            GameManager.NumPlayers--;
        }

        GameManager.GenerateDeck();

        cardStrings = new string[GameManager.NumPlayers];
        cardObjects = new GameObject[GameManager.NumPlayers];

        GameObject[] updatedAreas = GameObject.FindGameObjectsWithTag("PlayerArea");

        Debug.Log("Player areas found: " + updatedAreas.Length);

        Debug.Log("Number of players: " + GameManager.NumPlayers);

        // ____________________________________ Deal cards ____________________________________
        for (int j = 0; j < 6; j++)
        {
            for (int i = 0; i < GameManager.NumPlayers; i++)
            {
                GameManager.deck.Callback += DeckChanged;
                deck = GameManager.deck;
                GameObject newCard = Instantiate(CardPrefab, new Vector3(0, 0, 0), Quaternion.identity);
                // newCard.GetComponent<Selectable>().faceUp = true;
                newCard.name   = deck.Last <string>();
                cardStrings[i] = deck.Last <string>();
                cardObjects[i] = newCard;
                NetworkServer.Spawn(newCard);
                newCard.transform.SetParent(updatedAreas[i].transform, false);
                GameManager.UpdateDeck();
            }



            int index = 0;
            foreach (Mirror.NetworkConnectionToClient conn in GameManager.PlayerConnections)
            {
                if (conn != null)
                {
                    TargetDealCards(conn, cardStrings, cardObjects, index);
                    index++;
                }
            }
        }

        // ____________________________________ Initial Discard Card ____________________________________
        GameManager.deck.Callback += DeckChanged;
        deck = GameManager.deck;

        GameObject FirstDiscard = Instantiate(CardPrefab, new Vector3(0, 0, 0), Quaternion.identity);

        FirstDiscard.GetComponent <Selectable>().faceUp = true;
        FirstDiscard.name = deck.Last <string>();
        NetworkServer.Spawn(FirstDiscard);
        FirstDiscard.transform.SetParent(Discard.transform, false);
        RpcDrawCard(FirstDiscard, deck.Last <string>());
        GameManager.UpdateDeck();


        // ____________________________________ Reset Values ____________________________________
        GameManager.numReady       = 0;
        GameManager.RoundOver      = false;
        GameManager.MaxFlipped     = 2;
        GameManager.NewCardFlipped = false;

        GameManager.ChangeGameState("InitialCardFlip");
    }
コード例 #23
0
ファイル: ChatControl.cs プロジェクト: TimoSchmechel/SPG
 private void OnTextLChanged(SyncListString.Operation op, int index)
 {
     list.text += "\n" + textL[index];
 }
コード例 #24
0
ファイル: PlayerManager.cs プロジェクト: deliav04/GolfGame
    public void CmdStartGame()
    {
        // ____________________________________ Create deck button ____________________________________
        GameObject deckButton = Instantiate(deckButtonPrefab, new Vector3(-37, -49, 0), Quaternion.identity);

        deckButton.name = "DeckButton";
        NetworkServer.Spawn(deckButton);
        deckButton.transform.SetParent(mainCanvas.transform, false);
        startButton.SetActive(false);
        RpcStartGame(deckButton);

        // ____________________________________ Create player areas ____________________________________
        numPlayers = NetworkServer.connections.Count;

        GameManager.NumPlayers = numPlayers;
        GameManager.Scores     = new int[numPlayers];
        GameManager.AddPlayers();

        cardStrings = new string[numPlayers];
        cardObjects = new GameObject[numPlayers];
        PlayerNames = new string[numPlayers];
        PlayerAreas = new GameObject[numPlayers];

        // TODO: Let users input names
        for (int i = 0; i < numPlayers; i++)
        {
            PlayerNames[i] = "Player " + (i + 1).ToString();
        }

        for (int i = 0; i < numPlayers; i++)
        {
            GameObject playerArea = Instantiate(PlayerAreaPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            NetworkServer.Spawn(playerArea);
            playerArea.transform.GetChild(0).tag = "PlayerArea";
            if (isServer)
            {
                playerArea.name = i.ToString();
                PlayerAreas[i]  = (playerArea.transform.GetChild(0).gameObject);
                playerArea.transform.SetParent(Background.transform, false);
                playerArea.transform.SetAsFirstSibling();
            }

            int playerIndex = 0;
            foreach (Mirror.NetworkConnectionToClient conn in GameManager.PlayerConnections)
            {
                if (conn != null)
                {
                    TargetSpawnArea(conn, playerArea, PlayerNames, i, playerIndex, GameManager.NumPlayers);
                    playerIndex++;
                }
            }
        }



        // ____________________________________ Deal cards ____________________________________
        for (int j = 0; j < 6; j++)
        {
            for (int i = 0; i < numPlayers; i++)
            {
                GameManager.deck.Callback += DeckChanged;
                deck = GameManager.deck;
                GameObject newCard = Instantiate(CardPrefab, new Vector3(0, 0, 0), Quaternion.identity);
                // newCard.GetComponent<Selectable>().faceUp = true;
                newCard.name   = deck.Last <string>();
                cardStrings[i] = deck.Last <string>();
                cardObjects[i] = newCard;
                NetworkServer.Spawn(newCard);
                GameManager.UpdateDeck();
            }

            if (isServer)
            {
                int num = cardStrings.Length;
                for (int i = 0; i < num; i++)
                {
                    cardObjects[i].name = cardStrings[i];
                    (cardObjects[i]).transform.SetParent((PlayerAreas[i]).transform, false);
                }
            }

            Debug.Log("Num players: " + GameManager.NumPlayers);
            int index = 0;
            foreach (Mirror.NetworkConnectionToClient conn in GameManager.PlayerConnections)
            {
                if (conn != null)
                {
                    TargetDealCards(conn, cardStrings, cardObjects, index);
                    index++;
                }
            }
        }

        // ____________________________________ Initial Discard Card ____________________________________
        GameManager.deck.Callback += DeckChanged;
        deck = GameManager.deck;

        GameObject FirstDiscard = Instantiate(CardPrefab, new Vector3(0, 0, 0), Quaternion.identity);

        FirstDiscard.GetComponent <Selectable>().faceUp = true;
        FirstDiscard.name = deck.Last <string>();
        NetworkServer.Spawn(FirstDiscard);
        FirstDiscard.transform.SetParent(Discard.transform, false);
        RpcDrawCard(FirstDiscard, deck.Last <string>());
        GameManager.UpdateDeck();


        // ____________________________________ Score Board Setup ____________________________________
        for (int i = 1; i <= GameManager.NumPlayers; i++)
        {
            GameObject scoreText = Instantiate(GameManager.ScoreTextPrefab, new Vector3(0, 0, 0), Quaternion.identity);
            NetworkServer.Spawn(scoreText);
            PlayerScores.Add(scoreText);
            scoreText.GetComponent <Text>().text = "Player " + i.ToString() + "\n 0";
            scoreText.transform.SetParent(GameManager.ScoresObject.transform, false);
            RpcScoreRound(scoreText, i);
        }

        GameManager.ChangeGameState("InitialCardFlip");
    }
コード例 #25
0
ファイル: PlayerManager.cs プロジェクト: deliav04/GolfGame
    void CmdSwapCards(GameObject OldCard, GameObject NewCard, bool FaceUp, int NumFlipped, bool LastRound, int LastPlayer)
    {
        if (connectionToClient == GameManager.CurrPlayer)
        {
            Debug.Log("Here 3");
            string NewName = NewCard.name;
            Sprite NewFace = NewCard.GetComponent <UpdateSprite>().cardFace;
            NewCard.name = OldCard.name;
            NewCard.GetComponent <UpdateSprite>().cardFace = OldCard.GetComponent <UpdateSprite>().cardFace;

            OldCard.name = NewName;
            OldCard.GetComponent <UpdateSprite>().cardFace = NewFace;

            NewCard.GetComponent <Selectable>().faceUp = true;
            OldCard.GetComponent <Selectable>().faceUp = true;

            RpcSwapCards(OldCard, NewCard);
            Debug.Log("Here 1");
            GameManager.deck.Callback += DeckChanged;
            deck = GameManager.deck;
            if ((LastRound && GameManager.CurrPlayerIndex == LastPlayer) || deck.Count == 0)
            {
                RpcFlipAllCards();
                Debug.Log("All cards flipped?: " + Time.time);
                GameManager.ChangeGameState("Scoring");
                ScoreRound();
            }
            else
            {
                Debug.Log("Here 2");
                GameManager.CurrPlayerIndex++;
                if (GameManager.CurrPlayerIndex == GameManager.PlayerConnections.Count)
                {
                    GameManager.CurrPlayerIndex = 0;
                }
                GameManager.CurrPlayer = GameManager.PlayerConnections[GameManager.CurrPlayerIndex];

                while (GameManager.CurrPlayer == null)
                {
                    GameManager.CurrPlayerIndex++;
                    if (GameManager.CurrPlayerIndex == GameManager.PlayerConnections.Count)
                    {
                        GameManager.CurrPlayerIndex = 0;
                    }
                }

                HighlightPlayer();

                GameManager.NewCardFlipped = false;

                if (NumFlipped > GameManager.MaxFlipped)
                {
                    GameManager.MaxFlipped = NumFlipped;
                }
                Debug.Log("Here 3");
            }
        }
        else
        {
            if (!FaceUp)
            {
                TargetDecrementFipped(connectionToClient);
            }
        }
    }
コード例 #26
0
ファイル: ServerInfos.cs プロジェクト: Nakou/UDynNet
	void Awake(){
		playerList = new SyncListString();
		Debug.Log("Awake!");
		name = "ServerInfos";
	}
コード例 #27
0
ファイル: Baby.cs プロジェクト: VicSkywalker/W17401AR
 void Awake()
 {
     coreFindings      = new SyncListString();
     extremityFindings = new SyncListString();
 }
コード例 #28
0
ファイル: Chat.cs プロジェクト: melissay94/Everyone-Is-John
 //callback we registered for when the syncList changes
 private void OnChatUpdated(SyncListString.Operation op, int index)
 {
     chatWindow.text += chatLog [chatLog.Count - 1] + "\n";
 }
コード例 #29
0
ファイル: Player.cs プロジェクト: lfrankel/GGJ2017
 public void SetStringAtIndex(SyncListString stringList, int iIndex, string value)
 {
     stringList [iIndex] = value;
     stringList.Dirty(iIndex);
 }
コード例 #30
0
ファイル: Chat.cs プロジェクト: kyousuke916/Keep-Alive
 private void OnChatUpdated(SyncListString.Operation op, int index)
 {
     if (UIChat.Instance != null)
         UIChat.Instance.InsertDialog(mChatLog[mChatLog.Count - 1].ToString());
 }
コード例 #31
0
ファイル: Referee.cs プロジェクト: DrexelGoalBall/goalBall
    /// <summary>
    /// Adds string to the end of the queue.
    /// </summary>
    /// <param name="op"></param>
    /// <param name="index"></param>
    private void OnStringChanged(SyncListString.Operation op, int index)
    {
        //Debug.Log(op + " ... " + (index-1));

        if (op == SyncListString.Operation.OP_ADD)
        {
            playlist.Add(queue[index-1]);
        }
    }
コード例 #32
0
ファイル: UpdateSprite.cs プロジェクト: deliav04/GolfGame
    // Start is called before the first frame update
    void Start()
    {
        SyncListString deck = CreateDeck();

        // NetworkIdentity networkIdentity = NetworkClient.connection.identity;
        // playerManager = networkIdentity.GetComponent<PlayerManager>();
        GameManager = GameObject.Find("GameManager").GetComponent <GameManager>();

        string s = this.name;

        if (s[0] == 'D')
        {
            i += 13;
        }
        else if (s[0] == 'H')
        {
            i += 26;
        }
        else if (s[0] == 'S')
        {
            i += 39;
        }
        else if (s[0] == 'J')
        {
            i += 52;
        }

        if (s[1] == 'A')
        {
            i += 0;
        }
        else if (s[1] == 'J')
        {
            i += 10;
        }
        else if (s[1] == 'Q')
        {
            i += 11;
        }
        else if (s[1] == 'K')
        {
            i += 12;
        }
        else
        {
            if (s.Length == 3)
            {
                i += 9;
            }
            else
            {
                i += ((int)Char.GetNumericValue(s[1]) - 1);
            }
        }
        // foreach(string card in deck) {
        //     if (this.name == card) {
        //         cardFace = playerManager.cardFaces[i];
        //         break;
        //     }
        //     i++;
        // }

        // Debug.Log(i);
        cardFace = GameManager.cardFaces[i];

        image      = GetComponent <Image>();
        selectable = GetComponent <Selectable>();
    }
コード例 #33
0
ファイル: Scp079.cs プロジェクト: js6pak/EXILED
 /// <summary>
 /// Sets the locked doors <see cref="SyncListString"/>.
 /// </summary>
 /// <param name="player"></param>
 /// <param name="lockedDoors"></param>
 public static void SetLockedDoors(this ReferenceHub player, SyncListString lockedDoors) => player.scp079PlayerScript.lockedDoors = lockedDoors;
コード例 #34
0
 private void SetList(SyncListString l)
 {
     this.list = l;
 }