Exemplo n.º 1
0
    IEnumerator WaitForAssignAuthority()
    {
        WaitText.text = "建立同步";
        yield return(new WaitForSeconds(5f));

        if (isServer && this.tag == "HostHealth")
        {
            Debug.Log(this.name);
            Debug.Log("HOSTADDSTART");
            initialAddTime = Time.time;
            InvokeRepeating("AutoAdd", 0.1f, .1f);
        }
        if (!isServer && this.tag == "ClientHealth")
        {
            Debug.Log(this.name);
            Debug.Log("ClientADDSTART");
            initialAddTime = Time.time;
            InvokeRepeating("AutoAdd", 0.1f, .1f);
        }
        Debug.Log("startPet");

        if (isServer)
        {
            if (this.tag == "HostHealth")
            {
                StartCoroutine(StartCountDown());
                DecideWarrior();
            }
        }
        if (!isServer)
        {
            if (this.tag == "ClientHealth")
            {
                //		CountDownManager.SetNetPlayer(NetPlayer);
                DecideWarrior();
            }
        }

        if (PlayerData.PlayerName == null)
        {
            PlayerData.PlayerName = "我從Island進來";
        }


        if (isServer & this.tag == "HostHealth")
        {
            Debug.Log(Meterial.CanCake);
            Debug.Log("-------------------SetDoll-----------------");
            Debug.Log(PlayerData.HairStyle.Color[PlayerData.HairColor].name);
            Debug.Log(Resources.Load <Sprite>("Doll/Head/" + PlayerData.HairStyle.Color[PlayerData.HairColor].name));
            NetPlayer.CmdSetDoll(PlayerData.PlayerName, 0, PlayerData.HairStyle.Color[PlayerData.HairColor].name, PlayerData.EyesStyle.Color[PlayerData.EyesColor].name, PlayerData.MouseStyle.Color[0].name, PlayerData.ClothStyle.Color[PlayerData.ClothColor].name, PlayerData.PantsStyle.Color[PlayerData.PantsColor].name, PlayerData.UpperArmStand.name, (int)PlayerData.UserId);
            NetPlayer.CmdAssingName(0, PlayerData.PlayerName.ToString(), WarriorIconNum, Meterial.CanCake, WarriorNum, PetWarrior.isUpgrade);
            if (Meterial.CanCake)
            {
                NetPlayer.CmdCake(0);
            }
        }
        //		NetPlayer.CmdSetName(0,PlayerData.PlayerName.ToString());
        if (!isServer & this.tag == "ClientHealth")
        {
            Debug.Log("-------------------SetDoll-----------------");
            NetPlayer.CmdSetDoll(PlayerData.PlayerName, 1, PlayerData.HairStyle.Color[PlayerData.HairColor].name, PlayerData.EyesStyle.Color[PlayerData.EyesColor].name, PlayerData.MouseStyle.Color[0].name, PlayerData.ClothStyle.Color[PlayerData.ClothColor].name, PlayerData.PantsStyle.Color[PlayerData.PantsColor].name, PlayerData.UpperArmStand.name, (int)PlayerData.UserId);
            NetPlayer.CmdAssingName(1, PlayerData.PlayerName.ToString(), WarriorIconNum, Meterial.CanCake, WarriorNum, PetWarrior.isUpgrade);
            if (Meterial.CanCake)
            {
                NetPlayer.CmdCake(1);
            }
        }
        //		NetPlayer.CmdSetName(1,PlayerData.PlayerName.ToString());
    }