Exemplo n.º 1
0
 private static void CacheGameObject(string name)
 {
     if (!objCache.ContainsKey(name))
     {
         object action = FreeRuleConfig.XmlToObject(FreeRuleConfig.GetXmlContent(name));
         objCache.Add(name, action);
         cache.Add(name, SerializeUtil.ObjectToByte(action));
     }
 }
Exemplo n.º 2
0
        private void InitialWeaponSkill()
        {
            FreeRuleConfig config = FreeRuleConfig.GetRule("weaponSkill", SingletonManager.Get <ServerFileSystemConfigManager>().BootConfig.Mysql);

            foreach (GameTrigger trigger in config.Triggers.GetTriggers())
            {
                WeaponSkillFactory.RegisterSkill(FreeArgs, trigger);
            }
        }
Exemplo n.º 3
0
        public void SetGameMode(int mode, int mapId)
        {
            ContextsWrapper.contexts.session.serverSessionObjects.GameRule = mode;
            ContextsWrapper.RoomInfo.ModeId = mode;
            ContextsWrapper.RoomInfo.MapId  = mapId;
            FreeRuleEventArgs args = new FreeRuleEventArgs(ContextsWrapper.contexts);

            ContextsWrapper.FreeArgs = args;
            rule = new FreeGameRule(this);


            SimpleParaList spl = (SimpleParaList)args.GetDefault().GetParameters();

            spl.AddFields(new ObjectFields(ContextsWrapper.RoomInfo));
            spl.AddPara(new BoolPara("hxMode", SharedConfig.IsHXMod));
            spl.AddPara(new StringPara("version", FreeRuleConfig.GetVersion()));
        }
Exemplo n.º 4
0
        public override void DoAction(IEventArgs args)
        {
            List <DataRecord> list = MysqlUtil.SelectRecords("select * from realtime_rule where `rule` = '" + args.Rule.FreeType + "'", FreeRuleConfig.MysqlConnection);

            if (list.Count > 0)
            {
                string config = list[0].GetValue("config");
                if (!string.IsNullOrEmpty(config))
                {
                    object obj = FreeRuleConfig.XmlToObject(config);
                    if (obj is IGameAction)
                    {
                        if (obj is OrderAiAction)
                        {
                            ((IGameAction)obj).Reset(args);
                        }
                        else
                        {
                            ((IGameAction)obj).Act(args);
                        }
                    }
                }
            }
        }