Example #1
0
        /// <summary>
        /// 过滤条件(filter)
        /// </summary>
        /// <returns></returns>
        public virtual string GetFilter()
        {
            var filters = new Dictionary <string, string>();

            if (EntityNames?.Any() == true)
            {
                filters.Add("entity_names", string.Join(",", EntityNames));
            }

            if (ActiveTime != null)
            {
                filters.Add("active_time", ActiveTime.Value.ToUtcTicks().ToString());
            }
            else if (InactiveTime != null)
            {
                filters.Add("inactive_time", InactiveTime.Value.ToUtcTicks().ToString());
            }

            if (Columns?.Any() == true)
            {
                foreach (var c in Columns)
                {
                    filters[c.Key] = c.Value;
                }
            }
            if (filters.Any())
            {
                return(string.Join("|", filters.Select(o => $"{o.Key}:{o.Value}")));
            }
            else
            {
                return(null);
            }
        }
Example #2
0
 public override void Enter(Miner entity)
 {
     if (entity.Location != Miner.LocationType.Bank)
     {
         Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Goin' to the bank. Yes siree");
         entity.Location = Miner.LocationType.Bank;
     }
 }
Example #3
0
 public override void Enter(Miner entity)
 {
     if (entity.Location != Miner.LocationType.Goldmine)
     {
         Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Walking to the goldmine");
         entity.Location = Miner.LocationType.Goldmine;
     }
 }
Example #4
0
 public override void Enter(Miner entity)
 {
     if (entity.Location != Miner.LocationType.Saloon)
     {
         entity.Location = Miner.LocationType.Saloon;
         Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Boy, ah sure is thusty! Waling to the saloon");
     }
 }
Example #5
0
 public Entity(Entities parent, EntityNames name = EntityNames.None)
     : base(parent)
 {
     this._graphics = parent.Graphics;
     this._logic    = parent.Logic;
     this._parent   = parent;
     this._uid      = name;
 }
Example #6
0
 public override void Enter(MinerWife entity)
 {
     if (!entity.Cooking)
     {
         Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Putting the stew in the oven");
         MessageDispatcher.Instance.DispatchMessage(1.5f, entity.ID, entity.ID, (int)MessageReader.MessageType.Msg_StewReady, MessageDispatcher.NO_ADDITIONAL_INFO);
         entity.Cooking = true;
     }
 }
Example #7
0
        protected string GetRandomName()
        {
            var names = UniqueNames
                ? EntityNames.Except(ExceptEntityNames)
                : EntityNames;
            var name = names.GetRandomEntity();

            ExceptEntityNames.Add(name);
            return(name);
        }
Example #8
0
        /// <summary>
        /// Provide a new implementation for finding a name for an OptionSet. If the
        /// OptionSet is not global, we want the name to be the concatenation of the Entity's
        /// name and the Attribute's name.  Otherwise, we can use the default implementation.
        /// </summary>
        public string GetNameForOptionSet(EntityMetadata entityMetadata, OptionSetMetadataBase optionSetMetadata, IServiceProvider services)
        {
            var name = GetPossiblyConflictedNameForOptionSet(entityMetadata, optionSetMetadata, services);

            while (EntityNames.Contains(name))
            {
                name += "_Enum";
            }
            return(OptionSetNames.TryGetValue(name.ToLower(), out var overriden) ? overriden : name);
        }
Example #9
0
        public string Get(
            EntityNames type,
            [Argument(ShortName = 'n', LongName = "name")] string objectNameOrId = null,
            [Argument(ShortName = 'o', LongName = "output")] string outputFormat = null
            )
        {
            var transactionGetUseCase = ServiceProvider.GetService <ITransactionGetUseCase>();
            var list = transactionGetUseCase.Get().Take(10);

            return(this.ViewFormatted(list, outputFormat));
        }
Example #10
0
        public LookupForm(EntityNames entName, Type type, Dictionary <string, string> cols)
        {
            EntityName  = entName;
            EntityType  = type;
            ColumnNames = cols;

            InitializeComponent();
            client.GetLookupOjbectsCompleted += new EventHandler <GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);

            BindData();
        }
Example #11
0
        public EmployeeLookupForm(EntityNames entName, Type type, Dictionary<string, string> cols)
        {
            EntityName = entName;
            EntityType = type;
            ColumnNames = cols;
            
            InitializeComponent();
            client.GetLookupOjbectsCompleted += new EventHandler<GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);

            BindData();
        }
Example #12
0
        public string GetLookupOjbects(EntityNames entityName, int pageIndex, int pageSize, string sort, string filterString, IList <object> paras, ref int pageCount, string userID)
        {
            string objxml = "";
            object ents   = Utility.GetLookupData(entityName, pageIndex, pageSize, sort, filterString, paras, ref pageCount, userID);

            if (ents != null)
            {
                objxml = SerializerHelper.ContractObjectToXml(ents);
            }
            //object other = SerializerHelper.XmlToContractObject(objxml,typeof(T_HR_COMPANY[]));
            return(objxml);
        }
        protected void WriteEntitiesToJson(EntityNames entityName, IList <O> entities)
        {
            var orderedByCoutry = SortByCountry(entities);

            foreach (var countryPair in orderedByCoutry)
            {
                CreateDirectoryIfNotExists();
                var resultFileName = CreateCurrentCountryFileName(entityName, countryPair.Key);

                SerializeFile(resultFileName, countryPair.Value);
            }
        }
Example #14
0
        public virtual Entity Get(EntityNames uid)
        {
            foreach (Entity e in this._list)
            {
                if (uid == e.ID)
                {
                    return(e);
                }
            }

            return(null);
        }
Example #15
0
        //public static EntityObject[] GetLookupData(EntityNames entity, Dictionary<string, string> args)
        //{
        //    EntityObject[] ents = null;
        //    Type type = Type.GetType("SMT.SaaS.Permission.BLL." + entity.ToString() + "BLL");

        //    if (type != null)
        //    {
        //        ILookupEntity bll = (ILookupEntity)Activator.CreateInstance(type);
        //        ents =  bll.GetLookupData(args);
        //    }
        //    return ents;
        //}
        public static EntityObject[] GetLookupData(EntityNames entity, Dictionary <string, string> args, int pageIndex, int pageSize, string sort, string filterString, IList <object> paras, ref int pageCount)
        {
            EntityObject[] ents = null;
            Type           type = Type.GetType("SMT.SaaS.Permission.BLL." + entity.ToString() + "BLL");

            if (type != null)
            {
                ILookupEntity bll = (ILookupEntity)Activator.CreateInstance(type);
                ents = bll.GetLookupData(args, pageIndex, pageSize, sort, filterString, paras, ref pageCount);
            }
            return(ents);
        }
Example #16
0
        public static object GetLookupData(EntityNames entity, int pageIndex, int pageSize, string sort, string filterString, IList <object> paras, ref int pageCount, string userID)
        {
            object ents = null;
            Type   type = Type.GetType("SMT.HRM.BLL." + entity.ToString() + "BLL");

            if (type != null)
            {
                ILookupEntity bll = (ILookupEntity)Activator.CreateInstance(type);
                ents = bll.GetLookupData(pageIndex, pageSize, sort, filterString, paras, ref pageCount, userID);
            }
            return(ents);
        }
Example #17
0
        //public LookupForm(EntityNames entName, Type ttype, Dictionary<string, string> cols)
        //{
        //    EntityName = entName;
        //    type = ttype;
        //    ColumnNames = cols;

        //    InitializeComponent();
        //    client.GetLookupOjbectsCompleted += new EventHandler<GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);
        //    TitleContent = "系统字典-查询窗口";
        //    BindData();
        //}
        public LookupForm(EntityNames entName, Type ttype, string[] cols, Dictionary <string, string> para)
        {
            EntityName  = entName;
            type        = ttype;
            ColumnNames = cols;
            this.para   = para;
            InitializeComponent();
            client.GetLookupOjbectsCompleted += new EventHandler <GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);

            BindData();
            //client.CloseAsync();//龙康才新增
            //client.Abort();//龙康才新增
        }
Example #18
0
        public LookupForm(EntityNames entName, Type type, Dictionary<string, string> cols)
        {
            EntityName = entName;
            EntityType = type;
            ColumnNames = cols;

            InitializeComponent();

            client.GetLookupOjbectsCompleted += new EventHandler<GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);

            this.TitleContent = Utility.GetResourceStr(entName.ToString().ToUpper());
            BindData();
        }
Example #19
0
        //public LookupForm(EntityNames entName, Type ttype, Dictionary<string, string> cols)
        //{
        //    EntityName = entName;
        //    type = ttype;
        //    ColumnNames = cols;

        //    InitializeComponent();
        //    client.GetLookupOjbectsCompleted += new EventHandler<GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);
        //    TitleContent = "系统字典-查询窗口";
        //    BindData();
        //}
        public LookupForm(EntityNames entName, Type ttype, string[] cols, Dictionary<string, string> para)
        {
            EntityName = entName;
            type = ttype;
            ColumnNames = cols;
            this.para = para;
            InitializeComponent();
            client.GetLookupOjbectsCompleted += new EventHandler<GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);

            BindData();
            //client.CloseAsync();//龙康才新增
            //client.Abort();//龙康才新增
        }
Example #20
0
        public LookupForm(EntityNames entName, Type type, Dictionary <string, string> cols)
        {
            EntityName  = entName;
            EntityType  = type;
            ColumnNames = cols;

            InitializeComponent();

            client.GetLookupOjbectsCompleted += new EventHandler <GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);

            this.TitleContent = Utility.GetResourceStr(entName.ToString().ToUpper());
            BindData();
        }
Example #21
0
        public string Get(
            EntityNames type,
            [Argument(ShortName = 'n', LongName = "name")] string objectNameOrId = null,
            [Argument(ShortName = 'o', LongName = "output")] string outputFormat = null
            )
        {
            // var types = ServiceProvider.GetService<List<ITypeConfiguration>>();
            // var type = types.FirstOrDefault(f => objectType.In(f.Name, f.NamePlural, f.NameShort));

            // var transactionGetUseCase = ServiceProvider.GetService<ITransactionGetUseCase>();
            // var list = transactionGetUseCase.Get().Take(1);
            // return this.ViewFormatted(list, outputFormat);
            return("Category");
        }
Example #22
0
    public override void Enter(Miner entity)
    {
        if (entity.Location != Miner.LocationType.Shack)
        {
            Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Walin' home");
            entity.Location = Miner.LocationType.Shack;

            MessageDispatcher.Instance.DispatchMessage(MessageDispatcher.SEND_MSG_IMMEDIATELY,
                                                       entity.ID,
                                                       (int)EntityNames.EntityName.Wife_Elsa,
                                                       (int)MessageReader.MessageType.Msg_HiHoneyImHome,
                                                       MessageDispatcher.NO_ADDITIONAL_INFO);
        }
    }
Example #23
0
 public override bool OnMessage(Miner entity, Telegram telegram)
 {
     MessageReader.MessageType msg = (MessageReader.MessageType)telegram.Msg;
     switch (msg)
     {
     case MessageReader.MessageType.Msg_StewReady:
         Debug.Log("Message handled by " + EntityNames.GetNameOfEntity(entity.ID) +
                   " at time: " + Time.time);
         Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Okay, Hun, ahm a comin'!");
         entity.FSM.ChangeState(entity.GetMinerState(Miner.StateMinerType.StateEatStew));
         return(true);
     }
     return(false);
 }
Example #24
0
 public override void Execute(Miner entity)
 {
     if (!entity.Fatigued())
     {
         Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": All mah fatigue has drained away. " +
                   "Time to find more gold!");
         entity.FSM.ChangeState(entity.GetMinerState(Miner.StateMinerType.StateEnterMineAndDigForNugget));
     }
     else
     {
         entity.DecreaseFatigue();
         Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": ZZZZ...");
     }
 }
Example #25
0
        public LookupForm(EntityNames entName, Type type, Dictionary <string, string> cols, string filter, System.Collections.ObjectModel.ObservableCollection <object> paras)
        {
            EntityName  = entName;
            EntityType  = type;
            ColumnNames = cols;

            InitializeComponent();

            client.GetLookupOjbectsCompleted += new EventHandler <GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);

            this.TitleContent = Utility.GetResourceStr(entName.ToString().ToUpper());
            this.filter       = filter;
            this.paras        = paras;
            BindData();
        }
Example #26
0
        public Cell(int posx, int posy, GameOfLife.Mechanics.Entities parent, EntityNames name = EntityNames.Cell)
            : base(parent, name)
        {
            this._isAlive   = true;
            this._positionX = posx;
            this._positionY = posy;
            this.SetColor(255, 255, 255);
            this.Alpha       = 0;
            this._parent     = parent;
            this._isDrawable = true;

            this._brush = new SolidBrush(Color.FromArgb(this.Alpha, this.R, this.G, this.B));

            this._type = EntityType.Cell;
        }
Example #27
0
    public override void Execute(Miner entity)
    {
        entity.AddToGoldCarried(1);
        entity.IncreasseFatigue();
        Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Picking up a nugget");

        if (entity.PocketIsFull)
        {
            entity.FSM.ChangeState(entity.GetMinerState(Miner.StateMinerType.StateVisitBankAndDepositGold));
        }
        if (entity.Thirsty())
        {
            entity.FSM.ChangeState(entity.GetMinerState(Miner.StateMinerType.StateQuenchThirst));
        }
    }
Example #28
0
        public LookupForm(EntityNames entName, Type type, Dictionary<string, string> cols, string filter, System.Collections.ObjectModel.ObservableCollection<object> paras)
        {
            EntityName = entName;
            EntityType = type;
            ColumnNames = cols;

            InitializeComponent();

            client.GetLookupOjbectsCompleted += new EventHandler<GetLookupOjbectsCompletedEventArgs>(client_GetLookupOjbectsCompleted);

            this.TitleContent = Utility.GetResourceStr(entName.ToString().ToUpper());
            this.filter = filter;
            this.paras = paras;
            BindData();
        }
Example #29
0
    public override bool OnMessage(MinerWife entity, Telegram telegram)
    {
        MessageReader.MessageType msg = (MessageReader.MessageType)telegram.Msg;

        switch (msg)
        {
        case MessageReader.MessageType.Msg_HiHoneyImHome:
            Debug.Log("Message handled by " + EntityNames.GetNameOfEntity(entity.ID) + " at time: " +
                      Time.time);
            Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Hi honey. Let me make you some of mah fine " +
                      "country stew");
            entity.FSM.ChangeState(entity.GetMinerWifeState(MinerWife.StateMinerWifeType.StateCookStew));
            return(true);
        }
        return(false);
    }
Example #30
0
        public XmlAnalyze(string path)
        {
            var content = File.ReadAllText(path, Encoding.UTF8);

            XmlDocument doc = new XmlDocument();

            doc.LoadXml(content);
            var rootNode = doc.DocumentElement;

            var nodeList = rootNode.SelectNodes("//members/member[starts-with(@name,'T:')]");

            foreach (XmlNode node in nodeList)
            {
                var value      = node.Attributes["name"]?.Value;
                var entityName = value?.Split('.')?.LastOrDefault();

                //实体名 必须由 字母数字或下划线组成
                if (Regex.IsMatch(entityName, @"^[a-z\d_]+$", RegexOptions.Compiled | RegexOptions.IgnoreCase))
                {
                    var comment = node?.InnerText?.Trim();
                    EntityNames.Add(entityName);
                    EntityComments.Add(entityName, comment);

                    var xpath = value?.Replace("T:", "P:") + ".";
                    EntityXPaths.Add(entityName, xpath);
                }
            }

            foreach (var item in EntityXPaths)
            {
                var nodes = rootNode.SelectNodes($"//members/member[starts-with(@name,'{item.Value}')]");

                var ecKey = new KeyValuePair <string, string>(item.Key, EntityComments[item.Key]);

                var lstKV = new List <KeyValuePair <string, string> >();

                foreach (XmlNode node in nodes)
                {
                    var value    = node.Attributes["name"]?.Value;
                    var propName = value?.Split('.')?.LastOrDefault();
                    var comment  = node.InnerText?.Trim();

                    lstKV.Add(new KeyValuePair <string, string>(propName, comment));
                }
                Data.Add(ecKey, lstKV);
            }
        }
Example #31
0
    public override void Execute(MinerWife entity)
    {
        switch (Random.Range(0, 3))
        {
        case 0:
            Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Moppin' the floor");
            break;

        case 1:
            Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Washin' the dishes");
            break;

        case 2:
            Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Makin' the bed");
            break;
        }
    }
Example #32
0
    public override void OnInspectorGUI()
    {
        EditorGUI.BeginChangeCheck();

        CustomEditorUtility.DrawTitle("Instantiate " + EntityNames[t.indexInPool]);


        t.indexInPool = EditorGUILayout.Popup(t.indexInPool, EntityNames.ToArray());

        CustomEditorUtility.QuickSerializeObject(EntityNames[t.indexInPool], serializedObject);

        serializedObject.ApplyModifiedProperties();
        if (EditorGUI.EndChangeCheck())
        {
            EditorUtility.SetDirty(t);
        }
    }
Example #33
0
 public override void Execute(Miner entity)
 {
     entity.AddToWealth(entity.GoldCarried);
     entity.GoldCarried = 0;
     Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": Depositing gold. Total savings now " +
               entity.Wealth);
     if (entity.Wealth >= Miner.ComfortLevel)
     {
         Debug.Log(EntityNames.GetNameOfEntity(entity.ID) + ": WooHoo! Rich enough for now. Back " +
                   "home to mah li'lle lady");
         entity.FSM.ChangeState(entity.GetMinerState(Miner.StateMinerType.StateGoHomeAndSleepTilRested));
     }
     else
     {
         entity.FSM.ChangeState(entity.GetMinerState(Miner.StateMinerType.StateEnterMineAndDigForNugget));
     }
 }
Example #34
0
    public void DispatchDelayedMessage()
    {
        float currentTime = Time.time;

        var enumerator = priorityQueue.GetEnumerator();

        while (priorityQueue.Count > 0 && enumerator.MoveNext() &&
               enumerator.Current.DispatchTime > 0)
        {
            Telegram       telegram       = enumerator.Current;
            BaseGameEntity receiverEntity = EntityManager.Instance.GetEntityFromID(telegram.Receiver);
            Debug.Log("Queued telegram ready for dispatch: Sent to " + EntityNames.GetNameOfEntity(receiverEntity.ID) +
                      ". Msg is " + MessageReader.GetReadableMessage(telegram.Msg));
            Discharge(receiverEntity, telegram);
            priorityQueue.Remove(telegram);
        }
    }
Example #35
0
        public string GetLookupOjbects(EntityNames entityName, Dictionary<string, string> args, int pageIndex, int pageSize, string sort, string filterString, IList<object> paras, ref int pageCount)
        {
            string objxml = "";
            EntityObject[] ents = Utility.GetLookupData(entityName, args, pageIndex, pageSize, sort, filterString, paras, ref  pageCount);
            if (ents != null)
            {
                //  List<EntityObject> list = ents.ToList();
                objxml = Utility.SerializeObject(ents);
            }

            //例子
            //List<T_SYS_DICTIONARY> list1 = new List<T_SYS_DICTIONARY>();
            //list1 = BLLUtility.DeserializeObject<List<T_SYS_DICTIONARY>>(objxml);
            return objxml;
        }
Example #36
0
 public string GetLookupOjbects(EntityNames entityName, Dictionary<string, string> args, int pageIndex, int pageSize, string sort, string filterString, IList<object> paras, ref int pageCount, string userID)
 {
     string objxml = "";
     object ents = Utility.GetLookupData(entityName, args,pageIndex,pageSize,sort,filterString,paras, ref pageCount,userID);
     if (ents != null)
     {
         objxml = SerializerHelper.ContractObjectToXml(ents);
     }
     //object other = SerializerHelper.XmlToContractObject(objxml,typeof(T_HR_COMPANY[]));
     return objxml;
     //return null;
 }