Beispiel #1
0
        public static void POSTSvrstr(string query, string param, Action <string> cb, bool rcvJSONHandler = true, string method = "POST")
        {
            bool flag = query == null || query == "" || cb == null;

            if (!flag)
            {
                IURLReq iURLReq = os.net.CreateURLReq(null);
                iURLReq.url         = query;
                iURLReq.contentType = "application/x-www-form-urlencoded";
                iURLReq.dataFormat  = "text";
                string text = "";
                text += param;
                debug.Log(" POSTSvr query:" + query + "\n param:" + param);
                iURLReq.data   = text;
                iURLReq.method = method;
                iURLReq.load(delegate(IURLReq r, object vari)
                {
                    bool flag2 = vari == null;
                    if (flag2)
                    {
                        DebugTrace.print(" POSTSvr urlReq.load vari Null!");
                    }
                    string text2 = vari as string;
                    DebugTrace.print(" POSTSvr urlReq.loaded str[" + text2 + "]!");
                    Variant variant = JsonManager.StringToVariant(text2, true);
                    bool flag3      = cb != null;
                    if (flag3)
                    {
                        cb(text2);
                    }
                }, null, null);
            }
        }
Beispiel #2
0
        public IObjectPlugin createInst(string name, bool single)
        {
            bool          flag = !this.m_creators.ContainsKey(name);
            IObjectPlugin result;

            if (flag)
            {
                DebugTrace.print("err gameManagerBase createInst [" + name + "] notExsit!");
                result = null;
            }
            else
            {
                bool flag2 = single && this.m_objectPlugins.ContainsKey(name);
                if (flag2)
                {
                    DebugTrace.print("err gameManagerBase createInst single [" + name + "] repeated!");
                    result = this.m_objectPlugins[name];
                }
                else
                {
                    Func <IClientBase, IObjectPlugin> func = this.m_creators[name];
                    IObjectPlugin objectPlugin             = func(this);
                    objectPlugin.controlId = name;
                    if (single)
                    {
                        base.regEventDispatcher(name, objectPlugin as IGameEventDispatcher);
                        this.m_objectPlugins[name] = objectPlugin;
                    }
                    result = objectPlugin;
                }
            }
            return(result);
        }
        public IObjectPlugin createInst(string name, bool single)
        {
            if (!m_creators.ContainsKey(name))
            {
                DebugTrace.print("err gameManagerBase createInst [" + name + "] notExsit!");
                return(null);
            }
            if (single && m_objectPlugins.ContainsKey(name))
            {
                DebugTrace.print("err gameManagerBase createInst single [" + name + "] repeated!");
                return(m_objectPlugins[name] as IObjectPlugin);
            }

            Func <IClientBase, IObjectPlugin> create = m_creators[name];
            IObjectPlugin obj = create(this);


            obj.controlId = name;

            if (single)
            {
                regEventDispatcher(name, obj as IGameEventDispatcher);
                m_objectPlugins[name] = obj;
            }

            return(obj);
        }
 public void regCreator(string name, Func <IClientBase, IObjectPlugin> creator)
 {
     if (m_creators.ContainsKey(name))
     {
         DebugTrace.print("gameManagerBase regCreator [" + name + "] exsit!");
         return;
     }
     m_creators[name] = creator;
 }
 public IObjectPlugin getObject(string objectName)
 {
     if (!m_objectPlugins.ContainsKey(objectName))
     {
         DebugTrace.print("ERR gameManagerBase getObject [" + objectName + "] not exsit!");
         return(null);
     }
     return(m_objectPlugins[objectName]);
 }
Beispiel #6
0
        public Variant getEntityConf(string avatarid)
        {
            Variant conf = this.GraphMgr.getCharacterConf(avatarid);

            if (conf == null)
            {
                DebugTrace.print("  >>> ERR!  getCharacterConf avatarid[" + avatarid + "] null!");
            }
            return(conf);
        }
Beispiel #7
0
        public Variant getEffectConf(string effid)
        {
            Variant conf = GraphMgr.getEffectConf(effid);

            if (conf == null)
            {
                DebugTrace.print("  >>> ERR!  getEffectConf  effid[" + effid + "] null!");
            }
            return(conf);
        }
Beispiel #8
0
        public Variant getEffectConf(string effid)
        {
            Variant effectConf = this.GraphMgr.getEffectConf(effid);
            bool    flag       = effectConf == null;

            if (flag)
            {
                DebugTrace.print("  >>> ERR!  getEffectConf  effid[" + effid + "] null!");
            }
            return(effectConf);
        }
Beispiel #9
0
        public Variant getMapConf(string mapid)
        {
            Variant conf = GraphMgr.getMapConf(mapid);

            if (conf == null)
            {
                DebugTrace.print("  >>> ERR!  getMapConf mapid[" + mapid + "] null!");
            }

            return(conf);
        }
Beispiel #10
0
        public Variant getMapConf(string mapid)
        {
            Variant mapConf = this.GraphMgr.getMapConf(mapid);
            bool    flag    = mapConf == null;

            if (flag)
            {
                DebugTrace.print("  >>> ERR!  getMapConf mapid[" + mapid + "] null!");
            }
            return(mapConf);
        }
        public void removeEventListenerCL(string objectName, uint type, Action <GameEvent> listener)
        {
            if (!_dispatcherMap.ContainsKey(objectName))
            {
                DebugTrace.print("ERR removeEventListenerCL [" + objectName + "] not exsit!");
                return;
            }
            IGameEventDispatcher ged = _dispatcherMap[objectName];

            ged.removeEventListener(type, listener);;
        }
        public bool hasEventListenerCL(string objectName, uint type)
        {
            if (!_dispatcherMap.ContainsKey(objectName))
            {
                DebugTrace.print("ERR hasEventListenerCL [" + objectName + "] not exsit!");
                return(false);
            }
            IGameEventDispatcher ged = _dispatcherMap[objectName];

            return(ged.hasEventListener(type));;
        }
Beispiel #13
0
        public void regCreator(string name, Func <IClientBase, IObjectPlugin> creator)
        {
            bool flag = this.m_creators.ContainsKey(name);

            if (flag)
            {
                DebugTrace.print("gameManagerBase regCreator [" + name + "] exsit!");
            }
            else
            {
                this.m_creators[name] = creator;
            }
        }
Beispiel #14
0
        public Variant getAvatarConf(string chaid, string avaID, bool isleft = false)
        {
            if (isleft)
            {            //todoooo
                avaID = avaID + "L";
            }
            Variant conf = this.GraphMgr.getAvatarConf(chaid, avaID);

            if (conf == null)
            {
                DebugTrace.print("  >>> ERR!  getCharacterConf  chaid[" + chaid + "] avaID[" + avaID + "] null!");
            }
            return(conf);
        }
        //public void onSdkCallBack(Variant v)
        //{
        //    DebugTrace.print("onSdkCallBack:");
        //    DebugTrace.dumpObj(v);
        //    string cmd = v["cmd"]._str;
        //    if (AndroidSDKManager.SDKType.login.ToString() == cmd)
        //    {
        //        //_platId= "";
        //        onSelectPlatuid(v);
        //    }
        //    else
        //    {

        //    }
        //}

        private void onSelectPlatuid(Variant v)
        {
            if (!v.ContainsKey("data") || !v["data"].ContainsKey("pid") || !v["data"].ContainsKey("avatar") || !v["data"].ContainsKey("uid"))
            {
                DebugTrace.print("Erorr: Variant no`t Find <data>");
                DebugTrace.dumpObj(v);
                return;
            }

            string str1 = "platform=" + v["data"]["pid"]._str + "&sign=" + v["data"]["avatar"]._str + "&platuid=" + v["data"]["uid"]._str;

            //  str1 = "platform=qihooandroid&sign=7d065c0b871a4f280404070bc1aaa125|1439812387" + "&platuid=" + "2534758785";
            HttpAppMgr.POSTSvr(_query, str1, _getSeverListBack);
        }
Beispiel #16
0
        public void removeEventListenerCL(string objectName, uint type, Action <GameEvent> listener)
        {
            bool flag = !this._dispatcherMap.ContainsKey(objectName);

            if (flag)
            {
                DebugTrace.print("ERR removeEventListenerCL [" + objectName + "] not exsit!");
            }
            else
            {
                IGameEventDispatcher gameEventDispatcher = this._dispatcherMap[objectName];
                gameEventDispatcher.removeEventListener(type, listener);
            }
        }
        public bool dispatchEventCL(string objectName, GameEvent evt)
        {
            if (!_dispatcherMap.ContainsKey(objectName))
            {
                DebugTrace.print("ERR dispatchEventCL [" + objectName + "] not exsit!");
                return(false);
            }

            IGameEventDispatcher ged = _dispatcherMap[objectName];

            ged.dispatchEvent(evt);

            return(true);
        }
        public static void POSTSvr(string query, string param, Action <Variant> cb, bool rcvJSONHandler = true, string method = "POST")
        {
            ////这里要改成异步的才能继续
            //return;
            if (query == null || query == "" || cb == null)
            {
                return;
            }
            IURLReq urlReq = os.net.CreateURLReq(null);

            urlReq.url         = query;
            urlReq.contentType = NetConst.URL_CONTENT_TYPE_URLENCODE;
            urlReq.dataFormat  = NetConst.URL_DATA_FORMAT_TEXT;

            string data = "";

            data += param;
            debug.Log(" POSTSvr query:" + query + "\n param:" + param);
            urlReq.data = data;

            //DebugTrace.dumpObj("POSTSvr data:" + data);

            urlReq.method = method;


            urlReq.load(
                //delegate(IURLReq r, byte[] vari)
                delegate(IURLReq r, object vari)
            {
                if (vari == null)
                {
                    DebugTrace.print(" POSTSvr urlReq.load vari Null!");
                }
                string str = vari as string;

                DebugTrace.print(" POSTSvr urlReq.loaded str[" + str + "]!");

                Variant t = JsonManager.StringToVariant(str);

                if (cb != null)
                {
                    cb(JsonManager.StringToVariant(str));
                }
            },
                null,
                null
                );
        }
        public void regEventDispatcher(string objectName, IGameEventDispatcher ed)
        {
            if (_dispatcherMap.ContainsKey(objectName))
            {
                DebugTrace.print("ERR regEventDispatcher [" + objectName + "] exsit!");
                return;
            }

            if (ed == null)
            {
                DebugTrace.print("ERR regEventDispatcher [" + objectName + "] null!");
                return;
            }

            _dispatcherMap[objectName] = ed;
        }
Beispiel #20
0
        public IObjectPlugin getObject(string objectName)
        {
            bool          flag = !this.m_objectPlugins.ContainsKey(objectName);
            IObjectPlugin result;

            if (flag)
            {
                DebugTrace.print("ERR gameManagerBase getObject [" + objectName + "] not exsit!");
                result = null;
            }
            else
            {
                result = this.m_objectPlugins[objectName];
            }
            return(result);
        }
Beispiel #21
0
        protected IGREffectParticles attachEffect(string effid, bool single = true)
        {
            IGREffectParticles iGREffectParticles = this.createEffect(effid, single);
            bool flag = iGREffectParticles != null;

            if (flag)
            {
                GREntity3D gREntity3D = this.m_gr as GREntity3D;
                bool       flag2      = gREntity3D != null;
                if (!flag2)
                {
                    DebugTrace.print("attachEffect should be IGRCharacter!");
                }
            }
            return(iGREffectParticles);
        }
Beispiel #22
0
        public bool hasEventListenerCL(string objectName, uint type)
        {
            bool flag = !this._dispatcherMap.ContainsKey(objectName);
            bool result;

            if (flag)
            {
                DebugTrace.print("ERR hasEventListenerCL [" + objectName + "] not exsit!");
                result = false;
            }
            else
            {
                IGameEventDispatcher gameEventDispatcher = this._dispatcherMap[objectName];
                result = gameEventDispatcher.hasEventListener(type);
            }
            return(result);
        }
        //{
        //	//localConf = ClientConfigManager.create() as ClientConfigManager;
        //	//localConf.init(this);
        //}
        protected void formatClientconf(Variant conf)
        {
            for (int i = 0; i < conf["conf"].Count; i++)
            {
                Variant      clientconf = conf["conf"][i];
                string       name       = clientconf["name"]._str;
                configParser confInst   = createInst(name, true) as configParser;
                if (confInst == null)
                {
                    DebugTrace.print(" configParser [" + name + "] create failed! ");
                    continue;
                }
                confInst.initSet(clientconf["file"]._str, clientconf["preload"]._bool);
            }

            loadPreloadClientConfig(() => { });
        }
Beispiel #24
0
        public bool dispatchEventCL(string objectName, GameEvent evt)
        {
            bool flag = !this._dispatcherMap.ContainsKey(objectName);
            bool result;

            if (flag)
            {
                DebugTrace.print("ERR dispatchEventCL [" + objectName + "] not exsit!");
                result = false;
            }
            else
            {
                IGameEventDispatcher gameEventDispatcher = this._dispatcherMap[objectName];
                gameEventDispatcher.dispatchEvent(evt);
                result = true;
            }
            return(result);
        }
Beispiel #25
0
        protected IGREffectParticles attachEffect(string effid, string attachID, bool single = true)
        {
            IGREffectParticles eff = createEffect(effid, single);

            if (eff != null)
            {
                IGRCharacter grc = (m_gr as IGRCharacter);
                if (grc != null)
                {
                    grc.attachEntity(attachID, eff);
                }
                else
                {
                    DebugTrace.print("attachEffect should be IGRCharacter!");
                }
            }

            return(eff);
        }
Beispiel #26
0
        protected IGREffectParticles attachEffect(string effid, string attachID, bool single = true)
        {
            IGREffectParticles iGREffectParticles = this.createEffect(effid, single);
            bool flag = iGREffectParticles != null;

            if (flag)
            {
                IGRCharacter iGRCharacter = this.m_gr as IGRCharacter;
                bool         flag2        = iGRCharacter != null;
                if (flag2)
                {
                    iGRCharacter.attachEntity(attachID, iGREffectParticles);
                }
                else
                {
                    DebugTrace.print("attachEffect should be IGRCharacter!");
                }
            }
            return(iGREffectParticles);
        }
        protected void _loadNextPreloadClientConfig(List <configParser> toLoadClientConfigVec, Action onFin)
        {
            if (toLoadClientConfigVec.Count <= 0)
            {
                DebugTrace.print("configParser ended!");
                onFin();
                return;
            }
            _loadedFileCnt++;

            configParser toLoadConf = toLoadClientConfigVec[toLoadClientConfigVec.Count - 1];

            DebugTrace.print("try configParser[" + toLoadConf.controlId + "]");

            toLoadClientConfigVec.RemoveAt(toLoadClientConfigVec.Count - 1);
            toLoadConf.loadconfig(this.confM, (configParser confbase) =>
            {
                _loadNextPreloadClientConfig(toLoadClientConfigVec, onFin);
            });
        }
Beispiel #28
0
        public void regEventDispatcher(string objectName, IGameEventDispatcher ed)
        {
            bool flag = this._dispatcherMap.ContainsKey(objectName);

            if (flag)
            {
                DebugTrace.print("ERR regEventDispatcher [" + objectName + "] exsit!");
            }
            else
            {
                bool flag2 = ed == null;
                if (flag2)
                {
                    DebugTrace.print("ERR regEventDispatcher [" + objectName + "] null!");
                }
                else
                {
                    this._dispatcherMap[objectName] = ed;
                }
            }
        }
Beispiel #29
0
        private void createSceneObjectPair(lgGDBase mapCtrl, string ctrlName, string drawName)
        {
            LGGRBaseImpls lGGRBaseImpls = base.createInst(ctrlName, false) as LGGRBaseImpls;
            GRBaseImpls   gRBaseImpls   = base.createInst(drawName, false) as GRBaseImpls;
            bool          flag          = lGGRBaseImpls == null;

            if (flag)
            {
                DebugTrace.print("GRClient create ctrlName[" + ctrlName + "] null!");
            }
            else
            {
                bool flag2 = gRBaseImpls == null;
                if (flag2)
                {
                    DebugTrace.print("GRClient create drawName[" + drawName + "] null!");
                }
                else
                {
                    mapCtrl.initGr(gRBaseImpls, lGGRBaseImpls);
                    gRBaseImpls.initLg(mapCtrl);
                    lGGRBaseImpls.init();
                    gRBaseImpls.init();
                    lGGRBaseImpls.setGameCtrl(mapCtrl);
                    lGGRBaseImpls.setDrawBase(gRBaseImpls);
                    gRBaseImpls.setSceneCtrl(lGGRBaseImpls);
                    bool flag3 = "SCENE_MAIN_PLAY_CTRL" == ctrlName;
                    if (flag3)
                    {
                        base.g_processM.addRender(lGGRBaseImpls, true);
                        base.g_processM.addRender(gRBaseImpls, true);
                    }
                    else
                    {
                        base.g_processM.addRender(lGGRBaseImpls, false);
                        base.g_processM.addRender(gRBaseImpls, false);
                    }
                }
            }
        }
Beispiel #30
0
        public Variant getAvatarConf(string chaid, string avaID, bool isleft = false)
        {
            if (isleft)
            {
                avaID += "L";
            }
            Variant avatarConf = this.GraphMgr.getAvatarConf(chaid, avaID);
            bool    flag       = avatarConf == null;

            if (flag)
            {
                DebugTrace.print(string.Concat(new string[]
                {
                    "  >>> ERR!  getCharacterConf  chaid[",
                    chaid,
                    "] avaID[",
                    avaID,
                    "] null!"
                }));
            }
            return(avatarConf);
        }