Ejemplo n.º 1
0
 private void rawret(int addr, int type, int session, params object[] objs)
 {
     if (type == Skynet.TYPE_NORMAL)
     {
         Skynet.Send(self_handle, addr, Skynet.TYPE_RESPONSE, session, null, objs);
     }
 }
Ejemplo n.º 2
0
        public void DispatchMessage(int source, int dest, int type, int session, string func_name, params object[] args)
        {
            if (type == Skynet.TYPE_RESPONSE)
            {
                if (Debug)
                {
                    string source_name = null;
                    string dest_name   = null;

                    dest_name   = Skynet.QueryServiceName(dest);
                    source_name = Skynet.QueryServiceName(source);
                    if (source_name == null)
                    {
                        source_name = source.ToString();
                    }
                    if (dest_name == null)
                    {
                        dest_name = dest.ToString();
                    }
                    _.Log("#Skynet#", self_name + "(" + self_handle + ")", "      Frames: ", Time.frameCount, "      Handle Response Msg: ", source_name, "->", dest_name);
                }
                if (localsession_promisecb.ContainsKey(session))
                {
                    localsession_promisecb[session](args);
                    localsession_promisecb.Remove(session);
                }
            }
            else if (type == Skynet.TYPE_NORMAL)
            {
                if (Debug)
                {
                    string source_name = self_name;
                    string dest_name   = null;

                    dest_name = Skynet.QueryServiceName(dest);
                    if (source_name == null)
                    {
                        source_name = self_handle.ToString();
                    }
                    if (dest_name == null)
                    {
                        dest_name = dest.ToString();
                    }
                    _.Log("#Skynet#", self_name + "(" + self_handle + ")", "      Frames: ", Time.frameCount, "      Handle Normal Msg: ", source_name, "->", dest_name, ":", func_name);
                }
                IEnumerator ie = GetType()
                                 .GetMethod(func_name, System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic)
                                 .Invoke(this, args) as IEnumerator;
                localqueue.Enqueue(new cotask()
                {
                    ie = ie, call_session = session, call_addr = source, call_type = type, call_funcname = func_name, args = args
                });
                task_num = localqueue.Count;
            }
        }
Ejemplo n.º 3
0
        public int send(int addr, string func_name, params object[] args)
        {
            if (Debug)
            {
                string source_name = self_name;
                string dest_name   = null;

                dest_name = Skynet.QueryServiceName(addr);
                if (source_name == null)
                {
                    source_name = self_handle.ToString();
                }
                if (dest_name == null)
                {
                    dest_name = addr.ToString();
                }
                _.Log("#Skynet#", self_name + "(" + self_handle + ")", "      Frames: ", Time.frameCount, "      Send MSG: ", source_name, "->", dest_name, ":", func_name);
            }
            return(Skynet.Send(self_handle, addr, Skynet.TYPE_NORMAL, newSession(), func_name, args));
        }
Ejemplo n.º 4
0
 protected Promise call(string addr, string func_name, params object[] args)
 {
     return(call(Skynet.QueryService(addr), func_name, args));
 }
Ejemplo n.º 5
0
 public int send(string addr, string func_name, params object[] args)
 {
     return(send(Skynet.QueryService(addr), func_name, args));
 }
Ejemplo n.º 6
0
 void Awake()
 {
     instance = this;
 }