示例#1
0
 public static void ForEach <T>(this ICollect input, Action <T> action)
 {
     foreach (T i in input)
     {
         action(i);
     }
 }
示例#2
0
        public static T First <T>(this ICollect input)
        {
            foreach (T i in input)
            {
                return(i);
            }

            throw new InvalidOperationException("Sequence contains no elements.");
        }
 private void FinishCollectInit()
 {
     isCollect = false;
     collect   = null;
     PlayerInputManage.single.MayMove();
     playerAnimation.CancelBusy();
     Destroy(slider.gameObject);
     slider = null;
 }
示例#4
0
 public DataFlowMessageHandler(
     ICollect collect,
     DataFlowClient dataFlowClient,
     DataEntryFactory dataEntryFactory)
 {
     this.collect          = collect;
     this.dataFlowClient   = dataFlowClient;
     this.dataEntryFactory = dataEntryFactory;
 }
示例#5
0
        public DataCollectTest()
        {
            this._validShareWithValidPrice = BuildShare(22.2);
            this._validShareWithMinPrice   = BuildShare(-1);

            this._dataCollectWithMinPrice      = new MockDataCollect(_validShareWithMinPrice);
            this._dataCollectWithValidPrice    = new MockDataCollect(_validShareWithValidPrice);
            this._dataCollectWithValidObject   = new MockDataCollect(_validShareWithValidPrice);
            this._dataCollectWithInvalidObject = new MockDataCollect(null);
        }
示例#6
0
 public TroopComponent(int travelTime, List <TroopEntity> troops, int id, Dictionary <Supplies, float> wAmount, Dictionary <Supplies, float> dAmount, ICollect interactingObject, ICollect village)
 {
     Troops             = troops;
     TravelTime         = travelTime;
     RaidID             = id;
     _widthrawAmount    = wAmount;
     _depositAmount     = dAmount;
     _interactingObject = interactingObject;
     _startingLocation  = village;
 }
示例#7
0
    private void CheckTile(string name, Vector3Int pos)
    {
        var newPos = CheckPos(new Vector2(pos.x + 0.5f, pos.y + 2f));

        switch (name)
        {
        case "Village":
        {
            var village = _gameMaster.VillageSystem.GetVillage(pos);
            var info    = village.GetInfo();
            _miniUI = Instantiate(_miniUIPrefab, _headupDisplay.transform);
            _miniUI.GetComponent <UI.MinyUI>().UpdateUI(info);
            _miniUI.transform.position = newPos;
            break;
        }

        case "Grass":
        {
            OpenBuyUI(new KeyValuePair <Supplies, float>(Supplies.Food, 1), pos);
            break;
        }

        case "Mountain":
        {
            OpenBuyUI(new KeyValuePair <Supplies, float>(Supplies.Wood, 1), pos);
            break;
        }

        case "Forest":
        {
            OpenBuyUI(new KeyValuePair <Supplies, float>(Supplies.Water, 1), pos);
            break;
        }

        case "Lake":
        {
            OpenBuyUI(new KeyValuePair <Supplies, float>(Supplies.Stone, 1), pos);
            break;
        }

        default:
        {
            var collector = _gameMaster.CollectorSystem.GetCollector(pos);
            _collector = collector;
            var produce = collector.GetProduce();
            var consume = collector.GetConsume();


            _collectorUI = Instantiate(_collectorUIPrefab, _headupDisplay.transform);
            _collectorUI.GetComponent <CollectorUI>().UpdateUI(produce, consume, this);
            _collectorUI.transform.position = newPos;
            break;
        }
        }
    }
示例#8
0
        public static T[] ToArray <T>(this ICollect input)
        {
            var result = new T[input.Count];

            for (var i = 0; i < input.Count; i++)
            {
                result[i] = (T)input[i];
            }

            return(result);
        }
示例#9
0
 public static IEnumerable <T> Where <T>(this ICollect input, Predicate <T> predicate)
 {
     foreach (var i in input)
     {
         if (i is T t)
         {
             if (predicate(t))
             {
                 yield return(t);
             }
         }
     }
 }
    /// <summary>
    /// 检查是否可以交互
    /// </summary>
    private void RayInspect()
    {
        RaycastHit[] raycastHit = Physics.SphereCastAll(interactionPosition + transform.position, radius, transform.forward, radius / 2, layer);
        if (raycastHit.Length >= 1)
        {
            interaction = raycastHit[0].collider.GetComponent <IInteractionInterface>();
            if (interaction != null)
            {
                if (interaction.InteractionType == InteractionType.collect)
                {
                    collect = interaction as ICollect;
                    HintMessage.Single.ShowMessageText($"{collect.Name}:采集");
                }
                else if (interaction.InteractionType == InteractionType.bulid)
                {
                    HintMessage.Single.ShowMessageText("Q:销毁\nE:建造");
                    bulid = interaction as IBulid;
                }
            }
            else
            {
                House house = raycastHit[0].collider.GetComponent <House>();

                if (house != null)
                {
                    if (house.houseMenu.gameObject.activeSelf)
                    {
                        if (Input.GetKeyDown(KeyCode.E))
                        {
                            house.CloseMenu();
                        }
                        HintMessage.Single.CloseMessageText();
                    }
                    else
                    {
                        HintMessage.Single.ShowMessageText("E:打开菜单");
                        if (Input.GetKeyDown(KeyCode.E))
                        {
                            house.OpenMenu();
                        }
                    }
                }
            }
        }
        else
        {
            interaction = null;
            HintMessage.Single.CloseMessageText();
        }
    }
示例#11
0
 public static bool Contains <T>(this ICollect input, Predicate <T> predicate)
 {
     foreach (var i in input)
     {
         if (i is T t)
         {
             if (predicate(t))
             {
                 return(true);
             }
         }
     }
     return(false);
 }
示例#12
0
        private ICollect <int> CreateCollect(ICollect <int> collect, int index, int exp, int count)
        {
            Random rnd = new Random(DateTime.Now.Millisecond);

            for (int i = 0; i < count; i++)
            {
                if (i == index)
                {
                    collect.Add(exp);
                }
                else
                {
                    collect.Add(rnd.Next(int.MaxValue));
                }
            }
            return(collect);
        }
示例#13
0
        private void Explode()
        {
            RaycastHit2D[] hits = Physics2D.CircleCastAll(transform.position, m_Range, Vector2.zero);
            for (int i = 0; i < hits.Length; i++)
            {
                IHealth health = hits[i].collider.GetComponent <IHealth>();
                if (health != null)
                {
                    health.OnHit(this.gameObject);
                }
                ICollect collect = hits[i].collider.GetComponent <ICollect>();
                if (collect != null)
                {
                    collect.Collect();
                }
            }
            GameObject go = ResourcesMrg.Instance.Load(ResourcesMrg.ResourceType.Effect, "Explode", isCache: true);

            go.transform.position = transform.position;
            Destroy(this.gameObject);
        }
示例#14
0
 public HesapController(IUnitOfWork uow, IFactory f, ICollect collect) : base(uow, f, collect)
 {
 }
 public MessageController(IUnitOfWork uow, IFactory f, ICollect collect) : base(uow, f, collect)
 {
 }
示例#16
0
 public CategoryController(IUnitOfWork uow, IFactory f, ICollect collect) : base(uow, f, collect)
 {
 }
 public _BaseController(IUnitOfWork uow, IFactory f, ICollect collect)
 {
     _uow     = uow;
     _f       = f;
     _collect = collect;
 }
示例#18
0
 internal static CollectChainer Collect(this ICollect prev, Column[] values)
 {
     return(new CollectChainer((Chainer)prev, values));
 }
示例#19
0
 /// <summary>
 /// Generates the SELECT statement without the FROM clause returning the result set of the specified values.
 /// </summary>
 /// <param name="prev">A predecessor object.</param>
 /// <param name="firstValue">Is the first value.</param>
 /// <param name="otherValues">Are the other values.</param>
 public static CollectChainer Collect(this ICollect prev, Column firstValue, params Column[] otherValues)
 {
     return(new CollectChainer((Chainer)prev,
                               Common.MergeArrays(firstValue, otherValues)));
 }
示例#20
0
 public void Aftertestsuit()
 {
     subject = null;
 }
示例#21
0
 public void BeforeTestSuit()
 {
     //subject = new Mock<ICollect<int>>(MockBehavior.Strict).Object;
     subject = new CollectIntRev();
 }
 public WordsController(ICollect collector, IStorage store)
 {
     _collector = collector;
     _store     = store;
 }
 public ProductController(IUnitOfWork uow, IFactory f, ICollect collect, ILogging log) : base(uow, f, collect)
 {
     _log = log;
 }
示例#24
0
        public void AddGroup(int travelTime, List <TroopEntity> troops, Dictionary <Supplies, float> wAmount, Dictionary <Supplies, float> dAmount, ICollect interactingObject, ICollect village)
        {
            var temp = new TroopComponent(travelTime, troops, count, wAmount, dAmount, interactingObject, village);

            TroopGroup.Add(temp);
            count = count == int.MaxValue ? 0 : count + 1;
        }
示例#25
0
 public SelectionEventArgs(RoutedEvent input, ICollect selection) : base(input) => Selection = selection;