Inheritance: MonoBehaviour
コード例 #1
0
ファイル: OnDemandFetcher.cs プロジェクト: lackey94/rsunity-1
        public void start(StreamLoader streamLoader)
        {
            mapIndexData = UnityClient.ReadAllBytes(signlink.findcachedir() + "map_index.dat");           //streamLoader.getDataForName("map_index");
            byte[] mapIndexDataNew = UnityClient.ReadAllBytes(signlink.findcachedir() + "map_index.dat"); //streamLoader.getDataForName("map_index");
            Stream stream2         = new Stream(mapIndexDataNew);
            int    j1 = stream2.readUnsignedWord();                                                       //mapIndexDataNew.Length / 6;

            mapIndices1 = new int[j1];
            mapIndices2 = new int[j1];
            mapIndices3 = new int[j1];
            for (int i2 = 0; i2 < j1; i2++)
            {
                mapIndices1[i2] = stream2.readUnsignedWord();
                mapIndices2[i2] = stream2.readUnsignedWord();
                mapIndices3[i2] = stream2.readUnsignedWord();
                mapAmount++;
            }
            Debug.Log("Map Amount: " + mapAmount + "");
            mapIndexDataNew = streamLoader.getDataForName("midi_index");
            stream2         = new Stream(mapIndexDataNew);
            j1             = mapIndexDataNew.Length;
            anIntArray1348 = new int[j1];
            for (int k2 = 0; k2 < j1; k2++)
            {
                anIntArray1348[k2] = stream2.readUnsignedByte();
            }

            //clientInstance = client1;
            running = true;
            //clientInstance.startRunnable(this, 2);
            Loom.StartSingleThread(() => {
                run();
            }, System.Threading.ThreadPriority.Normal, true);
        }
コード例 #2
0
 private void Awake()
 {
     interactionVolume = gameObject.transform.Find("Interaction Volume").GetComponent <InteractionVolume>();
     Client            = GameObject.Find("Network").GetComponent <UnityClient>();
     Assert.IsNotNull(interactionVolume);
     objManager = GameObject.Find("Network").GetComponent <NetworkObjectManager>();
 }
コード例 #3
0
 public CharacterDamageable(IHealthSetter health, CharacterInfo info, UnityClient client, SceneGameplayProperties damageManager)
 {
     _health        = health;
     _info          = info;
     _client        = client;
     _damageManager = damageManager;
 }
コード例 #4
0
 void Start()
 {
     // Cache components
     drClient       = GetComponent <UnityClient>();
     uiManager      = UIManager.singleton;
     networkManager = GetComponent <NetworkManager>();
 }
コード例 #5
0
    private void Awake()
    {
        this.unityClient = FindObjectOfType <UnityClient>();
        this.unityClient.MessageReceived += OnMessageReceived;

        this.turretManager.Init(this.unityClient);
    }
コード例 #6
0
 private void Awake()
 {
     base.Awake();
     //////////////////
     /// Properties initialization
     clientReference = GetComponent <UnityClient>();
 }
コード例 #7
0
 public ServerManager(
     CmdServer server,
     UnityClient client)
 {
     _server = server;
     _client = client;
 }
コード例 #8
0
        /// <summary>
        /// Initializes the NetworkManager by:
        /// Spawning all the components needed.
        /// Listening to events.
        /// </summary>
        public static void Initialize()
        {
            Main.Log("Initializing NetworkManager");
            isHost   = false;
            isClient = false;
            if (!UGameObject.Exists("NetworkManager"))
            {
                networkManager      = Object.Instantiate(new GameObject(), Vector3.zero, Quaternion.identity);
                networkManager.name = "NetworkManager";
                server = networkManager.AddComponent <XmlUnityServer>();
                client = networkManager.AddComponent <UnityClient>();

                client.Disconnected += OnClientDisconnected;

                Object.DontDestroyOnLoad(networkManager);

                server.configuration = new TextAsset(File.ReadAllText("./Mods/DVMultiplayer/Resources/config.xml"));
            }

            if (UI == null)
            {
                UI = new NetworkingUI();
                UI.Setup();
            }
        }
コード例 #9
0
 public DeathRequestSender(IDamageable respawnable, UnityClient client, CharacterInfo info)
 {
     _damageable = respawnable;
     _client     = client;
     _info       = info;
     PreInitialize();
 }
コード例 #10
0
 public HealthUpdateSender(UnityClient client, IDamageable damageable, IHealth health, CharacterInfo info)
 {
     _client     = client;
     _damageable = damageable;
     _health     = health;
     _info       = info;
 }
コード例 #11
0
    public LobbyMenuManager(
        [Inject(Id = Identifiers.LobbyStartGameButton)]
        Button startGameButton,
        [Inject(Id = Identifiers.LobbyReadyButton)]
        Button readyButton,
        [Inject(Id = Identifiers.LobbyLeaveButton)]
        Button leaveButton,
        [Inject(Id = Identifiers.StartTextReady)]
        Text startTextReady,
        [Inject(Id = Identifiers.StartTextNotReady)]
        Text startTextNotReady,
        UnityClient client,
        ClientInfo clientInfo,
        ServerManager serverManager,
        LobbyMessageSender messageSender,
        LobbyStateManager lobbyStateManager,
        HostSceneManager sceneManager,
        IGameCycleController cycleController)
    {
        _readyButton      = readyButton;
        _leaveLobbyButton = leaveButton;
        _startGameButton  = startGameButton;

        _startTextReady    = startTextReady;
        _startTextNotReady = startTextNotReady;

        _client            = client;
        _clientInfo        = clientInfo;
        _sceneManager      = sceneManager;
        _cycleController   = cycleController;
        _serverManager     = serverManager;
        _messageSender     = messageSender;
        _lobbyStateManager = lobbyStateManager;
    }
コード例 #12
0
ファイル: UnityClient.cs プロジェクト: lackey94/rsunity-1
 public void renderWorld()
 {
     while (objectsToRender.Count > 0)
     {
         RuneObject rune = null;
         if (objectsToRender.Count > 0)
         {
             rune = objectsToRender [0];
         }
         if (rune != null)
         {
             rune.RenderMesh();
         }
         if (objectsToRender.Count > 0)
         {
             objectsToRender.RemoveAt(0);
         }
     }
     while (objectsToDispose.Count > 0)
     {
         GameObject rune = null;
         if (objectsToDispose.Count > 0)
         {
             rune = objectsToDispose [0];
         }
         if (rune != null)
         {
             UnityClient.DisposeRuneObject(rune);
         }
         if (objectsToDispose.Count > 0)
         {
             objectsToDispose.RemoveAt(0);
         }
     }
 }
コード例 #13
0
 public ShootCommandSender(UnityClient client, IWeapon weapon, CharacterInfo info)
 {
     _client = client;
     _weapon = weapon;
     _info   = info;
     PreInitialize();
 }
コード例 #14
0
 public DisconnectionManager(
     UnityClient client,
     GameCycle gameCycle)
 {
     _client    = client;
     _gameCycle = gameCycle;
 }
コード例 #15
0
ファイル: SpriteLoader.cs プロジェクト: lackey94/rsunity-1
    /*
     * Loads the sprite data and index files from the cache location.
     * This can be edited to use an archive such as config or media to load from the cache.
     *
     * @param archive
     */
    public static void loadSprites(StreamLoader streamLoader)
    {
        //try {
        RS2Sharp.Stream index        = new RS2Sharp.Stream(UnityClient.ReadAllBytes(signlink.findcachedir() + "sprites.idx"));
        RS2Sharp.Stream data         = new RS2Sharp.Stream(UnityClient.ReadAllBytes(signlink.findcachedir() + "sprites.dat"));
        DataInputStream indexFile    = new DataInputStream(new Ionic.Zlib.GZipStream(new MemoryStream(index.buffer), Ionic.Zlib.CompressionMode.Decompress));
        DataInputStream dataFile     = new DataInputStream(new Ionic.Zlib.GZipStream(new MemoryStream(data.buffer), Ionic.Zlib.CompressionMode.Decompress));
        int             totalSprites = indexFile.ReadInt();

        UnityEngine.Debug.Log("Sprites loaded: " + totalSprites);
        if (cache == null)
        {
            cache   = new SpriteLoader[totalSprites];
            sprites = new Sprite[totalSprites];
        }
        for (int i = 0; i < totalSprites; i++)
        {
            int id = indexFile.ReadInt();
            if (cache[id] == null)
            {
                cache[id] = new SpriteLoader();
            }
            cache[id].readValues(indexFile, dataFile);
            createSprite(cache[id]);
        }
        //indexFile.Close();
        //dataFile.Close();
        //} catch (Exception e) {
        //	e.printStackTrace();
        //}
    }
コード例 #16
0
    private void Awake()
    {
        string rawAddr = IniFile.IniReadValue(IniFile.Sections.Train, IniFile.Keys.Address);

        System.Net.IPAddress address;
        if (rawAddr == null)
        {
            address = defaultAddress;
            IniFile.IniWriteValue(IniFile.Sections.Train, IniFile.Keys.Address, address.ToString());
        }
        else
        {
            address = System.Net.IPAddress.Parse(rawAddr);
        }

        string rawPort = IniFile.IniReadValue(IniFile.Sections.Train, IniFile.Keys.Port);
        ushort port;

        if (rawPort == null)
        {
            port = defaultPort;
            IniFile.IniWriteValue(IniFile.Sections.Train, IniFile.Keys.Port, port.ToString());
        }
        else
        {
            port = ushort.Parse(rawPort);
        }

        //UnityClient client = gameObject.AddComponent(typeof(UnityClient)) as UnityClient;
        UnityClient client = gameObject.AddComponent <UnityClient>() as UnityClient;

        client.Address = address;
        client.Port    = port;
    }
コード例 #17
0
    private void Awake()
    {
        this.enemies = new Dictionary <uint, ClientEnemyController>();

        this.unityClient = FindObjectOfType <UnityClient>();
        this.unityClient.MessageReceived += OnMessageReceived;
    }
コード例 #18
0
ファイル: NetworkRelay.cs プロジェクト: MadDevX/IntoTheHive
    public NetworkRelay(
        UnityClient client)
    {
        _client = client;

        _messageHandlers = new Dictionary <ushort, List <Action <Message> > >();
        InitializeMessageHandlers();
    }
コード例 #19
0
 public EquipmentMessageSender(
     UnityClient client,
     CharacterFacade characterFacade
     )
 {
     _networkManager  = client;
     _characterFacade = characterFacade;
 }
コード例 #20
0
    void Awake()
    {
        //////////////////
        /// Properties initialization
        clientReference = GetComponent <UnityClient>();

        clientReference.MessageReceived += MessageReceived;
    }
コード例 #21
0
    // Use this for initialization
    void Start()
    {
        trace("Socket started.");

        client = new UnityClient();

        _counter = counterInterval;
    }
コード例 #22
0
 public MouseDetection(UnityClient client1)
 {
     syncObject     = new Object();
     coordsY        = new int[500];
     running        = true;
     coordsX        = new int[500];
     clientInstance = client1;
 }
コード例 #23
0
        private static void MainClient()
        {
            Client2 coreClient = new Client2("127.0.0.1");

            coreClient.SetAsClientSide();

            client = new UnityClient(coreClient, 1f);
            client.clockTicker.isClearOnInternalClock = false;
        }
コード例 #24
0
        static UnityWebRequest generateOrUpdateUnityClient(string projectGuid, string method, UnityClientInfo unityClientInfo, XiaomiSettings xiaomi, string callbackUrl)
        {
            // TODO read xiaomi info from user input
            UnityChannel channel = new UnityChannel();

            channel.xiaomi      = xiaomi;
            channel.projectGuid = projectGuid;
            channel.callbackUrl = callbackUrl;

            // set necessary client post data
            UnityClient client = new UnityClient();

            client.client_name = projectGuid;
            client.scopes.Add("identity");
            client.channel = channel;

            string api = null;

            if (method.Equals(UnityWebRequest.kHttpVerbPOST, StringComparison.InvariantCultureIgnoreCase))
            {
                api = "/v1/oauth2/user-clients";
            }
            else if (method.Equals(UnityWebRequest.kHttpVerbPUT, StringComparison.InvariantCultureIgnoreCase))
            {
                // if client is not generated or loaded, directly ignore update
                if (unityClientInfo.ClientId == null)
                {
                    Debug.LogError("Please get/generate Unity Client first.");
                    loaded = false;
                    return(null);
                }
                if (updateRev == null)
                {
                    Debug.LogError("Please get/generate Unity Client first.");
                    loaded = false;
                    return(null);
                }
                client.rev = updateRev;
                if (orgId == null)
                {
                    Debug.LogError("Please get/generate Unity Client first.");
                    loaded = false;
                    return(null);
                }
                client.owner     = orgId;
                client.ownerType = "ORGANIZATION";
                api = "/v1/oauth2/user-clients/" + unityClientInfo.ClientId;
            }
            else
            {
                return(null);
            }

            string token = tokenInfo.access_token;

            return(asyncRequest(method, url, api, token, client));
        }
コード例 #25
0
 public LobbyMessageSender(
     UnityClient client,
     LobbyState lobbyState,
     SceneMessageSender sceneMessageSender)
 {
     _client             = client;
     _lobbyState         = lobbyState;
     _sceneMessageSender = sceneMessageSender;
 }
コード例 #26
0
    private void Awake()
    {
        client = GameObject.FindGameObjectWithTag("NetworkManager").GetComponent <UnityClient>();
        Assert.IsNotNull(client);

        mainCameraTransform     = GameObject.FindGameObjectWithTag("MainCamera").transform;
        defaultCollider.enabled = true;
        holdCollider.enabled    = false;
    }
コード例 #27
0
 public WeaponChangedMessageSender(
     IWeapon weapon,
     UnityClient unityClient,
     CharacterFacade characterFacade)
 {
     _weapon          = weapon;
     _unityClient     = unityClient;
     _characterFacade = characterFacade;
 }
コード例 #28
0
    // Use this for initialization
    void Start()
    {
        turnInProgress = false;
        Debug.Log("current player" + UnityClient.currentPlayer + " number of players " + UnityClient.numberOfPlayers);
        Debug.Log((UnityClient.currentPlayer + 1 % UnityClient.numberOfPlayers));

        multiplayerInfo = (UnityClient)GameObject.FindObjectOfType <UnityClient>();
        button.SetActive(false);
    }
コード例 #29
0
 /// <summary>
 /// Sends ushort message to Server
 /// </summary>
 /// <param name="txt"></param>
 /// <param name="tag"></param>
 public static void SendToServer(ushort number, ushort tag, UnityClient client)
 {
     using (DarkRiftWriter writer = DarkRiftWriter.Create())
     {
         writer.Write(number);
         using (Message playerMessage = Message.Create(tag, writer))
             client.SendMessage(playerMessage, SendMode.Reliable);
     }
 }
コード例 #30
0
 public ConnectionMenuMessageSender(
     UnityClient client,
     SceneMessageSender sceneMessageSender,
     PlayerOptions playerOptions)
 {
     _client             = client;
     _sceneMessageSender = sceneMessageSender;
     _playerOptions      = playerOptions;
 }