Ejemplo n.º 1
0
 public void InviteToGroup(BasicPlayerInfo player)
 {
     make_rpc(client.InviteToGroupAsync(new InviteToGroupAttempt
     {
         PlayerId = player.PermanentId
     }, deadline: make_deadline(), headers: headers), (d) => OnInviteToGroup(player, d));
 }
Ejemplo n.º 2
0
 public void SendFriendRequest(BasicPlayerInfo player)
 {
     make_rpc(client.SendFriendRequestAsync(new FriendRequestAttempt
     {
         PlayerId = player.PermanentId
     }, deadline: make_deadline(), headers: headers), (d) => OnSendFriendRequest(player, d));
 }
Ejemplo n.º 3
0
 public void UnIgnorePlayer(BasicPlayerInfo player)
 {
     make_rpc(client.UnIgnorePlayerAsync(new UnIgnorePlayerAttempt
     {
         PlayerId = player.PermanentId
     }, deadline: make_deadline(), headers: headers), (d) => OnUnIgnorePlayer(player, d));
 }
Ejemplo n.º 4
0
 public void RemoveFriend(BasicPlayerInfo player)
 {
     make_rpc(client.RemoveFriendAsync(new RemoveFriendAttempt
     {
         PlayerId = player.PermanentId
     }, deadline: make_deadline(), headers: headers), (d) => OnRemoveFriend(player, d));
 }
Ejemplo n.º 5
0
 public void AnswerFriendRequest(BasicPlayerInfo player)
 {
     make_rpc(client.AnswerFriendRequestAsync(new AnswerFriendRequestAttempt
     {
         From = player.PermanentId
     }, deadline: make_deadline(), headers: headers), (d) => OnAnswerFriendRequest(player, d));
 }
Ejemplo n.º 6
0
 private static void on_group_invite_timed_out(Event_GroupInviteTimedOut ev)
 {
     if (group_invite == null)
     {
         Debug.LogError("Got group invite timed out message but the data store thought there where no group invite in the first place!");
     }
     group_invite = null;
 }
Ejemplo n.º 7
0
    // Use this for initialization
    void Start()
    {
        audios = GetComponents <AudioSource>();
        flame  = transform.Find("Flame").GetComponent <ParticleSystem>();
        slip   = transform.Find("Slip").GetComponent <ParticleSystem>();
        // dust = transform.Find("Dust").GetComponent<ParticleSystem>();
        Vector2 min = Camera.main.ViewportToWorldPoint(new Vector2(0, 0));
        Vector2 max = Camera.main.ViewportToWorldPoint(new Vector2(1, 1));

        Player.print("width:" + min.x + " , " + max.x);
        Player.print("height:" + min.y + " , " + max.y);
        //StartCoroutine(initPlayers());
        // SpriteRenderer spriteRenderer = GetComponent<Renderer>() as SpriteRenderer;
        int charIndex = 0;

        for (int i = 0; i < BasicPlayerInfo.instance.CharacterDiscription.Length; i++)
        {
            if (role == BasicPlayerInfo.instance.CharacterDiscription[i])
            {
                charIndex = i;
                break;
            }
        }
        //if (role == "ninja")
        //     spriteRenderer.sprite = sprites[0];
        // else if (role == "hunter")
        //     spriteRenderer.sprite = sprites[1];
        // else if (role == "enchanter")
        //     spriteRenderer.sprite = sprites[2];
        // else if (role == "thief")
        //     spriteRenderer.sprite = sprites[3];
        CmdInitializeAll();
        maincamera        = Camera.main;
        m_RigidBody2D     = GetComponent <Rigidbody2D>();
        armatureComponent = GetComponent <UnityArmatureComponent>();
        Player.print("eyes" + eyes + "char" + charIndex + "skin" + skin);
        BasicPlayerInfo.UpdateEyes(eyes, armatureComponent);
        BasicPlayerInfo.UpdateChar(charIndex, armatureComponent);
        BasicPlayerInfo.UpdateColor(skin, armatureComponent);
        int index = 1;

        GameObject[] objs = GameObject.FindGameObjectsWithTag("Player");
        foreach (GameObject gameObj in objs)
        {
            Player p = gameObj.GetComponent <Player>();
            p.GetComponent <UnityArmatureComponent>().transform.position = new Vector3(0.0f, 0.0f, -15.0f + index);
            index++;
            if (p.isLocalPlayer)
            {
                armatureComponent.transform.position = new Vector3(0.0f, 0.0f, -15.0f);
            }
        }
        items    = new List <string>();
        speedmul = 0.5f;
        initPlayers();
        // Warning!!!! make all character's slot as 1
        slots = 1;
    }
Ejemplo n.º 8
0
 private static void on_remove_friend(BasicPlayerInfo player, RemoveFriendResult r)
 {
     if (r.NoLongerFriend)
     {
         if (!BasicPlayerInfoOps.RemoveOne(friends, player))
         {
             Debug.Log("Tried to remove friend but friend was not well... a friend.");
         }
     }
 }
Ejemplo n.º 9
0
 private static void on_unignored_player(BasicPlayerInfo player, UnIgnorePlayerResult r)
 {
     if (!r.IsIgnored)
     {
         if (!BasicPlayerInfoOps.RemoveOne(ignored, player))
         {
             Debug.LogError("Server said to us player is ignored but according to the data store the player was never ignored!");
         }
     }
 }
 public void ChgColorBtnOnClick()
 {
     BasicPlayerInfo.instance.colorIndex += 1;
     BasicPlayerInfo.instance.colorIndex %= BasicPlayerInfo.colorRange;
     if (armatureComponent)
     {
         BasicPlayerInfo.UpdateColor(BasicPlayerInfo.instance.colorIndex, armatureComponent);
         armatureComponent.animation.Play("HeadBlink", 1);
     }
 }
 public void ChgEyesBtnOnClick()
 {
     BasicPlayerInfo.instance.eyesIndex += 1;
     BasicPlayerInfo.instance.eyesIndex %= BasicPlayerInfo.eyesRange;
     if (armatureComponent)
     {
         BasicPlayerInfo.UpdateEyes(BasicPlayerInfo.instance.eyesIndex, armatureComponent);
         armatureComponent.animation.Play("Blink", 1);
     }
 }
Ejemplo n.º 12
0
 private static void on_send_friend_request(BasicPlayerInfo target, FriendRequestResult r)
 {
     if (r.IsNowPending)
     {
         if (BasicPlayerInfoOps.Contains(pending_friends_outgoing, target))
         {
             Debug.LogError("Server added pending outgoing friend but the datastore thinks the player is already in the pending list.");
             return;
         }
         pending_friends_outgoing.Add(target);
     }
 }
Ejemplo n.º 13
0
        private static void on_answer_friend_request(BasicPlayerInfo player, AnswerFriendRequestResult r)
        {
            if (r.NowFriend)
            {
                if (BasicPlayerInfoOps.Contains(friends, player))
                {
                    Debug.LogError("Server added friend but the data store thinks the player is already a friend");
                    return;
                }

                friends.Add(player);
            }
        }
Ejemplo n.º 14
0
        private static void on_ignore_player(BasicPlayerInfo player, IgnorePlayerResult r)
        {
            if (r.IsIgnored)
            {
                if (BasicPlayerInfoOps.Contains(ignored, player))
                {
                    Debug.Log("Server said to us player is ignored and the data store already have that player as ignored. Hopefully we just tried to ignore an already ignored player.");
                    return;
                }

                ignored.Add(player);
            }
        }
Ejemplo n.º 15
0
 internal Player(Guid session_id, PlayerInfo pi)
 {
     permanent_id = pi.permanent_id;
     display_name = pi.display_name;
     friends      = pi.friends;
     ignored      = pi.ignored;
     pending_friend_requests_outgoing = pi.pending_friend_requests_outgoing;
     cached_basic_player_info         = new BasicPlayerInfo
     {
         DisplayName = display_name,
         PermanentId = pi.permanent_id,
         Online      = online
     };
 }
    public void ChgCharBtnOnClick()
    {
        BasicPlayerInfo.instance.characterIndex += 1;
        BasicPlayerInfo.instance.characterIndex %= BasicPlayerInfo.characterRange;

        if (armatureComponent)
        {
            BasicPlayerInfo.UpdateChar(BasicPlayerInfo.instance.characterIndex, armatureComponent);
            armatureComponent.animation.Play("Excited", 1);
        }

        GameObject.Find("Char").GetComponentInChildren <Text> ().text =
            BasicPlayerInfo.instance.CharacterDiscription[BasicPlayerInfo.instance.characterIndex];
    }
 void Awake()
 {
     if (instance)
     {
         Destroy(gameObject);
     }
     else
     {
         instance       = this;
         playerName     = "";
         characterIndex = 0;
         eyesIndex      = 0;
         colorIndex     = 0;
         DontDestroyOnLoad(gameObject);
     }
 }
Ejemplo n.º 18
0
        public static bool Contains(List <BasicPlayerInfo> l, BasicPlayerInfo player)
        {
            if (l == null)
            {
                return(false);
            }
            var permanent_id = player.PermanentId;
            var count        = l.Count;

            for (var i = 0; i < count; ++i)
            {
                var item = l[i];
                if (item.PermanentId == permanent_id)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 19
0
        internal void AddIgnoredPlayerIfNotAlreadyThere(BasicPlayerInfo player)
        {
            for (var i = 0; i < ignored.Count; ++i)
            {
                var info = ignored[i];
                if (info == null)
                {
                    Log.Warning("Ignored list contains nullable values.");
                    continue;
                }

                if (info.PermanentId == player.PermanentId)
                {
                    //There is already an entry of this player.
                    return;
                }
            }

            ignored.Add(player);
        }
    // Use this for initialization
    void Start()
    {
        alert.SetActive(false);
        playerNameInput.text = BasicPlayerInfo.instance.playerName;
        buttons[BasicPlayerInfo.instance.characterIndex].onClick.Invoke();
        buttons[BasicPlayerInfo.instance.characterIndex].Select();

        UnityFactory.factory.LoadDragonBonesData("MarvinCat/MarvinCat_ske");
        UnityFactory.factory.LoadTextureAtlasData("MarvinCat/MarvinCat_tex");
        armatureComponent = UnityFactory.factory.BuildArmatureComponent("MarvinCat");
        BasicPlayerInfo.UpdateEyes(BasicPlayerInfo.instance.eyesIndex, armatureComponent);
        BasicPlayerInfo.UpdateChar(BasicPlayerInfo.instance.characterIndex, armatureComponent);
        BasicPlayerInfo.UpdateColor(BasicPlayerInfo.instance.colorIndex, armatureComponent);
        armatureComponent.animation.Play("JumpBlink", 1);
        armatureComponent.transform.localPosition = new Vector3(-1.0f, -1.0f, -7.0f);
        armatureComponent.transform.localScale    = new Vector3(0.8f, 0.8f, 2.0f);
        //armatureComponent.DispatchEvent(UnityEngine.EventType.MouseDown, )
        //armatureComponent.AddEventListener (UnityEngine.EventType.MouseDown, AnimationController.PlayRandomEventHandler);
        armatureComponent.gameObject.AddComponent <AnimationController>();
        BoxCollider box = armatureComponent.gameObject.AddComponent <BoxCollider> ();

        box.size   = new Vector3(2.0f, 4.0f, 1.0f);
        box.center = new Vector3(0.0f, 1.0f, 0.0f);
    }
Ejemplo n.º 21
0
 private static void on_group_invite(Event_GotGroupInvite ev)
 {
     group_invite = ev.FromPlayer;
 }