Exemplo n.º 1
0
        public void ConvertToBytesTest3()
        {
            var bs = UtilByte.ConvertToBytes("0xFF", string.Empty);

            bs.Length.Should().Be(1);
            bs[0].Should().Be(Convert.ToByte(255));
        }
Exemplo n.º 2
0
        public void ConvertToBytesTest7()
        {
            var bs = UtilByte.ConvertToBytes("0xFF/0xFF/0xFF/0xFF", "/");

            bs.Length.Should().Be(4);
            bs[0].Should().Be(Convert.ToByte(255));
            bs[1].Should().Be(Convert.ToByte(255));
            bs[2].Should().Be(Convert.ToByte(255));
            bs[3].Should().Be(Convert.ToByte(255));
        }
Exemplo n.º 3
0
        public void ConvertToBytesTest2()
        {
            var bs = UtilByte.ConvertToBytes("FFFFFFFF", string.Empty);

            bs.Length.Should().Be(4);
            bs[0].Should().Be(Convert.ToByte(255));
            bs[1].Should().Be(Convert.ToByte(255));
            bs[2].Should().Be(Convert.ToByte(255));
            bs[3].Should().Be(Convert.ToByte(255));
        }
Exemplo n.º 4
0
    public void constructAll()
    {
        UtilByte.checkEndian();     // 检查系统大端小端

        Ctx.m_instance.m_cfg          = new Config();
        Ctx.m_instance.m_factoryBuild = new FactoryBuild();

        Ctx.m_instance.m_netMgr     = new NetworkMgr();
        Ctx.m_instance.m_logSys     = new LogSys();
        Ctx.m_instance.m_resLoadMgr = new ResLoadMgr();
        Ctx.m_instance.m_inputMgr   = new InputMgr();

        Ctx.m_instance.m_processSys    = new ProcessSys();
        Ctx.m_instance.m_tickMgr       = new TickMgr();
        Ctx.m_instance.m_timerMgr      = new TimerMgr();
        Ctx.m_instance.m_frameTimerMgr = new FrameTimerMgr();
        Ctx.m_instance.m_coroutineMgr  = new CoroutineMgr();
        Ctx.m_instance.m_shareData     = new ShareData();
        Ctx.m_instance.m_sceneSys      = new SceneSys();
        Ctx.m_instance.m_layerMgr      = new LayerMgr();

        Ctx.m_instance.m_uiMgr      = new UIMgr();
        Ctx.m_instance.m_uiSceneMgr = new UISceneMgr();
        Ctx.m_instance.m_engineLoop = new EngineLoop();
        Ctx.m_instance.m_resizeMgr  = new ResizeMgr();

        Ctx.m_instance.m_playerMgr    = new PlayerMgr();
        Ctx.m_instance.m_monsterMgr   = new MonsterMgr();
        Ctx.m_instance.m_fObjectMgr   = new FObjectMgr();
        Ctx.m_instance.m_npcMgr       = new NpcMgr();
        Ctx.m_instance.m_spriteAniMgr = new SpriteAniMgr();

        Ctx.m_instance.m_camSys       = new CamSys();
        Ctx.m_instance.m_aiSystem     = new AISystem();
        Ctx.m_instance.m_sysMsgRoute  = new SysMsgRoute("SysMsgRoute");
        Ctx.m_instance.m_moduleSys    = new ModuleSys();
        Ctx.m_instance.m_tableSys     = new TableSys();
        Ctx.m_instance.m_localFileSys = new LocalFileSys();
        Ctx.m_instance.m_langMgr      = new LangMgr();
        //Ctx.m_instance.m_pWebSocketMgr = new WebSocketMgr();
        Ctx.m_instance.m_sceneCardMgr   = new SceneCardMgr();
        Ctx.m_instance.m_sceneEffectMgr = new SceneEffectMgr();
    }
Exemplo n.º 5
0
    public void Send()
    {
        c_login p = new c_login();

        p.Username = "******";
        p.Password = "******";

        short code = 1001;

        byte[] intBytes3 = p.ToByteArray();
        short  ss        = (short)(intBytes3.Length + 2);

        byte[] intBytes1 = UtilByte.shortToBytes(ss);
        byte[] intBytes2 = UtilByte.shortToBytes(code);
        byte[] newArray  = new byte[2 + 2 + intBytes3.Length];

        Array.Copy(intBytes1, 0, newArray, 0, intBytes1.Length);
        Array.Copy(intBytes2, 0, newArray, intBytes1.Length, intBytes2.Length);
        Array.Copy(intBytes3, 0, newArray, intBytes1.Length + intBytes2.Length, intBytes3.Length);

        Debug.Log("ssssssssssssss=" + ss + " lllll=" + intBytes1.Length);
        socket.SendMessage(newArray);
    }
Exemplo n.º 6
0
 public void ConvertToBytesTest9()
 {
     Assert.Throws <ArgumentException>(() => UtilByte.ConvertToBytes("FFF", string.Empty));
 }
Exemplo n.º 7
0
 public void ConvertToBytesTest8()
 {
     Assert.Throws <FormatException>(() => UtilByte.ConvertToBytes("0xKK/0xFF/0xFF/0xFF", "/"));
 }