Ejemplo n.º 1
0
 private void PrintPlayer(z0Vk.user user)
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label(String.Format(table, user.nick, user.frags, user.ping, user.fps, user.deaths));
     AddKickButton(user);
     GUILayout.EndHorizontal();
 }
Ejemplo n.º 2
0
    private void RPCSetUserView(NetworkPlayer nwid, string nick, int uid, string photo, int tk, int td, int tzk, int tzd)
    {

        CallRPC(true, localuser.nwid, localuser.nick, localuser.uid, localuser.photo, tk, td, tzk, tzd);
        if (nwid == Network.player) return;

        z0Vk.user user = new z0Vk.user();
        user.nick = nick;
        user.uid = uid;
        user.photo = photo;
        user.nwid = nwid;
        user.totalkills = tk;
        user.totaldeaths = td;
        user.totalzombiekills = tzk;
        user.totalzombiedeaths = tzd;

        if (photo != "")
            new WWW2(photo).done += delegate(WWW2 www)
            {
                print("loaded texture");
                user.texture = www.www.texture;
                DontDestroyOnLoad(user.texture);
            };
        userviews.Add(nwid.GetHashCode(), user);

    }
Ejemplo n.º 3
0
    private void RPCSetUserView(NetworkPlayer nwid, string nick, int uid, string photo, int tk, int td, int tzk, int tzd)
    {
        CallRPC(true, localuser.nwid, localuser.nick, localuser.uid, localuser.photo, tk, td, tzk, tzd);
        if (nwid == Network.player)
        {
            return;
        }

        z0Vk.user user = new z0Vk.user();
        user.nick              = nick;
        user.uid               = uid;
        user.photo             = photo;
        user.nwid              = nwid;
        user.totalkills        = tk;
        user.totaldeaths       = td;
        user.totalzombiekills  = tzk;
        user.totalzombiedeaths = tzd;

        if (photo != "")
        {
            new WWW2(photo).done += delegate(WWW2 www)
            {
                print("loaded texture");
                user.texture = www.www.texture;
                DontDestroyOnLoad(user.texture);
            }
        }
        ;
        userviews.Add(nwid.GetHashCode(), user);
    }
}
Ejemplo n.º 4
0
    protected override void Window(int wid)
    {
        if (GUILayout.Button("X", GUILayout.ExpandWidth(false)))
        {
            enabled = false;
        }
        sel = (Tab)GUILayout.Toolbar((int)sel, new string[] { lc.tpz.ToString(), lc.tk.ToString() });

        const string table = "{0,30}{1,20}{2,10}";

        GUILayout.Label(string.Format(table, "", lc.kills, lc.deaths));

        SortedList <float, z0Vk.user> score = sel == Tab.TopZombieKill ? _vk.highscoresZombie : _vk.highscores;

        scrollPosition = GUILayout.BeginScrollView(scrollPosition);
        if (score.Count == 32)
        {
            for (int i = score.Values.Count - 1; i >= 0; i--)
            {
                z0Vk.user user = score.Values[i];
                GUILayout.Label(string.Format(table, user.nick, user.totalkills, user.totaldeaths));
            }
        }
        GUILayout.EndScrollView();
        GUI.DragWindow();
    }
Ejemplo n.º 5
0
 private void AddKickButton(z0Vk.user user)
 {
     GUILayout.Label(user.texture, GUILayout.Width(50), GUILayout.Height(40));
     if (Network.isServer && user.nwid != Network.player && GUILayout.Button(lc.kick.ToString()))
     {
         rpcwrite(user.nick + lc.kicked);
         Network.CloseConnection(user.nwid, true);
         RPCUserDisconnected(user.nwid.GetHashCode());
     }
 }
Ejemplo n.º 6
0
    void Update()
    {
        if (vk._Status == z0Vk.Status.connected)
        {
            if (_TimerA.TimeElapsed(5000))
            {
                _vk.GetChatMessages(0, true);
            }
            if (_TimerA.TimeElapsed(6000))
            {
                _vk.GetMessages();
            }
            //if (_TimerA.TimeElapsed(10000))
            //    _vk.GetNews();
            foreach (z0Vk.response resp in _vk.GetResponses())
            {
                foreach (z0Vk.message_info msg in resp.messages)
                {
                    msg.message = WWW.UnEscapeURL(msg.message);
                    printC(z0Vk.ToDate(msg.time) + " " + msg.user_name + ":" + msg.message);
                }
                foreach (z0Vk.status st in resp.statuses)
                {
                    if (friends.ContainsKey(st.uid))
                    {
                        if (friends[st.uid].st.timestamp < st.timestamp)
                        {
                            friends[st.uid].st     = st;
                            friends[st.uid].online = true;
                        }
                    }
                    else
                    {
                        Debug.Log("status user not exists" + st.uid);
                    }
                }


                foreach (z0Vk.message msg in resp.personal)
                {
                    msg.body = WWW.UnEscapeURL(msg.body);
                    if (friends.ContainsKey(msg.uid))
                    {
                        z0Vk.user     user = friends[msg.uid];
                        MessageWindow w    = GetWindow(user);
                        w.Write(user.nick + ":" + msg.body);
                    }
                    else
                    {
                        Debug.Log("user not exists" + msg.uid);
                    }
                }
            }
        }
    }
Ejemplo n.º 7
0
 public override void OnSetOwner()
 {
     print("set owner");
     if (isOwner)
     {
         name = "LocalPlayer";
     }
     else
     {
         name = "RemotePlayer" + OwnerID;
     }
     _Spawn.players.Add(OwnerID, this);
     userview = userviews[OwnerID];
 }
Ejemplo n.º 8
0
    private MessageWindow GetWindow(z0Vk.user user)
    {
        MessageWindow msgw;

        if (windows.ContainsKey(user.uid))
        {
            msgw = windows[user.uid];
        }
        else
        {
            msgw      = gameObject.AddComponent <MessageWindow>();
            msgw.user = user;
            windows.Add(user.uid, msgw);
        }
        return(msgw);
    }
Ejemplo n.º 9
0
 public override void OnSetOwner()
 {
     print("set owner");
     if (isOwner)
         name = "LocalPlayer";
     else
         name = "RemotePlayer" + OwnerID;
     _Spawn.players.Add(OwnerID, this);
     userview = userviews[OwnerID];
 }