Esempio n. 1
0
    void Start()
    {
        btn1.onClick.AddListener(() => {
            Ssui.Invoke <ITestRequest>(() => (t) => t.TestRequest(100, "string"));
        });

        btn2.onClick.AddListener(() => {
            var array = new int[] { 1, 2, 3, 4 };
            Ssui.Invoke <ITestRequest>(() => (t) => t.TestRequest(100, "string", array));
        });

        btn3.onClick.AddListener(() => {
            var array   = new int[] { 1, 2, 3, 4 };
            var packets = new ITestPacket[] {
                new TestPacket()
                {
                    Name = "abc", Password = "******"
                },
                new TestPacket()
                {
                    Name = "cde", Password = "******"
                },
            };
            Ssui.Invoke <ITestRequest>(() => (t) => t.TestRequest(100, "string", array, packets));
        });

        btn4.onClick.AddListener(() => {
            var dict = new Dictionary <int, ITestPacket>()
            {
                { 1, new TestPacket()
                  {
                      Name = "abc", Password = "******"
                  } },
                { 2, new TestPacket()
                  {
                      Name = "cde", Password = "******"
                  } }
            };

            Ssui.Invoke <ITestRequest>(() => (t) => t.TestRequest("Test", dict));
        });

        Register <ITestResponse>(
            (resp) => resp.TestResponse(null, null, null, null),
            () => this.TestResponse(null, null, null, null));

        Register <ITestResponse>(
            (resp) => resp.TestResponse(0, null, null, null),
            () => this.TestResponse(0, null, null, null));

        Register <ITestResponse>(
            (resp) => resp.TestResponse(0, null, null, null, null),
            () => this.TestResponse(0, null, null, null, null));

        Register <ITestResponse>(
            (resp) => resp.TestResponse(0, null, null, null, null, null),
            () => this.TestResponse(0, null, null, null, null, null));

        Ssui.RegisterPacket <ITestPacket, TestPacket>();
    }
 private void Awake()
 {
     if (_created)
     {
         return;
     }
     DontDestroyOnLoad(gameObject);
     _created = true;
     Ssui.Initialize();
 }