コード例 #1
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;
        }

        Vk.user user = new Vk.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.texture;
                DontDestroyOnLoad(user.texture);
            }
        }
        ;
        userviews.Add(nwid.GetHashCode(), user);
    }
コード例 #2
0
    void Awake()
    {
        if (Duplicate())
        {
            return;
        }
        print("loader awake");
        if (isWebPlayer)
        {
            new WWW2("dict.xml").done += delegate(WWW2 w)
            {
                try
                {
                    using (Stream s = new MemoryStream(w.bytes))
                        lc = (Localize)xml.Deserialize(s);
                }
                catch
                {
                    printC("Dictionary could not be loaded");
                }
                dictLoaded();
            };
        }
        else
        {
            print(Directory.GetCurrentDirectory());
            try
            {
                using (Stream s = File.Open("dict.xml", FileMode.Open))
                    lc = (Localize)xml.Deserialize(s);
                print("dict loaded");
            }
            catch
            {
                using (Stream s = File.Open("dict.xml", FileMode.Create))
                    xml.Serialize(s, lc);
                print("dict created");
            }
            File.Delete("log.txt");
            Application.RegisterLogCallback(onLog);
            dictLoaded();
        }
        _Loader  = this;
        _options = this.GetComponent <OptionsWindow>();

        DontDestroyOnLoad(this);
        networkView.group = 1;


        localuser = new Vk.user();

        foreach (IPAddress ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
        {
            ips += ip + ",";
        }
    }
コード例 #3
0
 private void AddKickButton(Vk.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());
     }
 }
コード例 #4
0
    private void PrintPlayer(Vk.user user)
    {
        const string table = "{0,15}{1,10}{2,10}{3,10}{4,10}";

        GUILayout.Label(String.Format(table, "", lc.kills, lc.ping, lc.fps, lc.deaths));
        GUILayout.BeginHorizontal();
        GUILayout.Label(String.Format(table, user.nick, user.frags, user.ping, user.fps, user.deaths));
        AddKickButton(user);
        GUILayout.EndHorizontal();
    }
コード例 #5
0
ファイル: Loader.cs プロジェクト: ConnectDeveloper01/dorumon
    void Awake()
    {
        if (Duplicate()) return;
        print("loader awake");
        if (isWebPlayer)
        {
            new WWW2("dict.xml").done += delegate(WWW2 w)
            {
                try
                {
                    using (Stream s = new MemoryStream(w.bytes))
                        lc = (Localize)xml.Deserialize(s);
                }
                catch
                {
                    printC("Dictionary could not be loaded");
                }
                dictLoaded();
            };
        }
        else
        {
            print(Directory.GetCurrentDirectory());
            try
            {
                using (Stream s = File.Open("dict.xml", FileMode.Open))
                    lc = (Localize)xml.Deserialize(s);
                print("dict loaded");
            }
            catch
            {
                using (Stream s = File.Open("dict.xml", FileMode.Create))
                    xml.Serialize(s, lc);
                print("dict created");
            }            
            File.Delete("log.txt");
            Application.RegisterLogCallback(onLog);
            dictLoaded();
        }        
        _Loader = this;
        _options = this.GetComponent<OptionsWindow>();

        DontDestroyOnLoad(this);
        networkView.group = 1;


        localuser = new Vk.user();

        foreach (IPAddress ip in Dns.GetHostEntry(Dns.GetHostName()).AddressList)
            ips += ip + ",";
    }
コード例 #6
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;

        Vk.user user = new Vk.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.texture;
                DontDestroyOnLoad(user.texture);
            };
        userviews.Add(nwid.GetHashCode(), user);

    }