示例#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));
     }
 }
示例#2
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);
                        }
                    }
                }
            }
        }