예제 #1
0
    /// <summary>
    /// Test the http task & sample
    /// </summary>
//	void testHttpTask_OnMainThread () {
//
//		HttpTask task = new HttpTask(ThreadType.MainThread, TaskResponse.Default_Response);
//		//HttpTask task = new HttpTask(ThreadType.MainThread); is the same as above line.
//
//		task.AppendCommonParam(RequestType.GET_PARTITION_SERVER, new PartitionServerParam(1,Native.mInstace.m_thridParty.GetAccountData()) );
//
//		Debug.Log("task request = " + JsonFx.Json.JsonWriter.Serialize(task) );
//
//		task.taskCompeleted += testHttpResp_Mainthread;
//		task.ErrorOccured += testHttpResp_Error;
//		task.afterCompleted += testHttpResp_UI;
//
//		//then you should dispatch to a real handler
//		task.DispatchToRealHandler();
//
//	}

//	void testHttpTask_OnBackGround() {
//		HttpTask task = new HttpTask(ThreadType.BackGround, TaskResponse.Default_Response);
//		//HttpTask task = new HttpTask(ThreadType.BackGround); is the same as above line.
//
//		task.AppendCommonParam(RequestType.GET_PARTITION_SERVER, new PartitionServerParam(1,Native.mInstace.m_thridParty.GetAccountData()) );
//
//		Debug.Log("task request = " + JsonFx.Json.JsonWriter.Serialize(task) );
//
//		task.taskCompeleted += () => { ConsoleEx.DebugLog(" --- Http Resp - running in the background, ### Lambda Expression ###"); };
//		task.ErrorOccured += testHttpResp_Error;
//
//		//then you should dispatch to a real handler
//		task.DispatchToRealHandler();
//	}

    void testHttpTask_InternalCommand()
    {
        HttpTask task = new HttpTask(ThreadType.BackGround);

        task.AppendCmdParam(InternalRequestType.SHUT_DOWN);

        Debug.Log("task request = " + JsonFx.Json.JsonWriter.Serialize(task));

        //then you should dispatch to a real handler
        task.DispatchToRealHandler();
    }
예제 #2
0
 void ICore.Dispose()
 {
     if (httpEngine != null)
     {
         HttpTask shutdownTask = new HttpTask(ThreadType.BackGround, TaskResponse.Default_Response);
         shutdownTask.AppendCmdParam(InternalRequestType.SHUT_DOWN);
         httpEngine.sendHttpTask(shutdownTask);
     }
     // Socket is still empty
     if (SockEngine != null)
     {
         SocketTask shutdownTask = new SocketTask(ThreadType.BackGround, TaskResponse.Default_Response);
         shutdownTask.AppendCmdParam(InternalRequestType.SHUT_DOWN);
         SockEngine.sendSocketTask(shutdownTask);
     }
 }