Exemplo n.º 1
0
    public static void PopulateItemDatabase()
    {
        uint dbId = 1;

        Inventory.DbAddNewDefinition(new MeleeWeapon(dbId++, "Sword", 20, 20, 15, 1.5f, true));
        Inventory.DbAddNewDefinition(new MeleeWeapon(dbId++, "Hammer", 30, 30, 12, 1.5f, true));
        Inventory.DbAddNewDefinition(new Armor(dbId++, "Helmet", 30, 30, 5, "HeadMount", false));
        Inventory.DbAddNewDefinition(new Armor(dbId, "Chestplate", 30, 30, 12, "ChestMount", false));

        NetSerializer.Add <MeleeWeapon>(ItemSerializer, ItemDeserializer);
        NetSerializer.Add <IInvItem>(ItemSerializer, ItemDeserializer);
    }
Exemplo n.º 2
0
    void Start()
    {
        socket      = GetComponent <NetSocket>();
        viewManager = GetComponent <NetViewManager>();
        zoneClient  = GetComponent <NetZoneClient>();

        zoneClient.OnZoneSetupSuccess          += ZoneSetupSuccessful;
        socket.Events.OnConnectedToServer      += ConnectedToServer;
        socket.Events.OnDisconnectedFromServer += DisconnectedFromServer;
        viewManager.OnNetViewCreated           += OnNetViewCreated;

        socket.StartSocket();
        socket.RegisterRpcListener(this);

        NetSerializer.Add <Item>(Item.Serialize, Item.Deserialize);
        NetSerializer.Add <Equip>(Item.Serialize, Item.Deserialize);

        socket.Connect(serverIps[serverIpIndex] + ":" + serverPort);
    }
Exemplo n.º 3
0
    void Start()
    {
        socket         = GetComponent <NetSocket>();
        zoneManager    = GetComponent <NetZoneManager>();
        zoneServer     = GetComponent <NetZoneServer>();
        netViewManager = GetComponent <NetViewManager>();

        zoneServer.OnAssignment += AssignedToZone;

        socket.ProtocolAuthority = true;
        socket.AcceptConnections = true;
        socket.MaxConnections    = 512;

        socket.Events.OnPeerApproval       += PeerApproval;
        socket.Events.OnSocketStart        += SocketStart;
        socket.Events.OnFailedToConnect    += FailedToConnect;
        socket.Events.OnClientDisconnected += OnClientDisconnect;

        socket.StartSocket(ServerAddress + ":" + ServerPortRoot);
        socket.RegisterRpcListener(this);

        NetSerializer.Add <Item>(Item.Serialize, Item.Deserialize);
        NetSerializer.Add <Equip>(Item.Serialize, Item.Deserialize);
    }