public TeleportStation(IBusinessOwner owner, IEnumerable<IPath> galacticMap, ILocation location)
 {
     this.owner = owner;
     this.galacticMap = galacticMap;
     this.location = location;
     this.resources = new Resources();
 }
        public void SetUp()
        {
            mockResources = Substitute.For<IResources>();
            mockGameObject = Substitute.For<IGameObject>();

            _instance = new GameStartupCommand();
            _instance.resources = mockResources;
            _instance.gameObject = mockGameObject;
        }
 /// <summary>   Default constructor. </summary>
 ///
 public BolterInterface()
 {
     _basePath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(new[] { '\\' });
     _localCamera = new Camera();
     _localMovement = new Movement();
     _localGameCalls = new GameCalls();
     _localInput = new Input();
     _localResources = new Resources(Path.GetDirectoryName(_basePath) + "\\Resources\\Items.obj");
     _localTarget = new Target();
     _localZone = new Zone();
     _localInventory = new Inventory();
     Bolter.GlobalInterface = this;
 }
 public NewMainViewModel(IWeatherService service, IResources resources)
 {
     this.service = service;
     this.resources = resources;
     this.City = new ReactiveProperty<string>();
     this.Temperature = new ReactiveProperty<string>();
     this.Wind = new ReactiveProperty<string>();
     this.Humidity = new ReactiveProperty<string>();
     this.ImageResource = new ReactiveProperty<string>();
     this.PreviousImageResource = new ReactiveProperty<string>();
     this.CurrentImageResource = new ReactiveProperty<string>();
     this.NextImageResource = new ReactiveProperty<string>();
     this.PreviousName = new ReactiveProperty<string>();
     this.CurrentName = new ReactiveProperty<string>();
     this.NextName = new ReactiveProperty<string>();
     this.Phrase = new ReactiveProperty<string>(this.resources.LoadingPhrase);
     this.IsLoading = new ReactiveProperty<bool>();
     this.RefreshCommand = new AsyncDelegateCommand(_ => this.Reload());
 }
Example #5
0
 public Unit(int identificationNumber, string nickName)
 {
     this.identificationNumber = identificationNumber;
     this.nickName = nickName;
     this.resources = new Resources();
 }
Example #6
0
        public IResources Pay(IResources cost)
        {
            this.resources.BronzeCoins -= cost.BronzeCoins;
            this.resources.SilverCoins -= cost.SilverCoins;
            this.resources.GoldCoins -= cost.GoldCoins;

            return new Resources(cost.BronzeCoins, cost.SilverCoins, cost.GoldCoins);
        }
Example #7
0
 public ProcessBombCommandSystem(Contexts contexts) : base(contexts.game)
 {
     _contexts  = contexts;
     _resources = contexts.config.resources.value;
     _bombs     = contexts.game.GetGroup(GameMatcher.Bomb);
 }
Example #8
0
 public WorkerBuilding(string name, IResources price, int workers) : base(name, price)
 {
     Workers = workers;
 }
Example #9
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="resources">An object that can access stored response</param>
 /// <exception cref="ArgumentNullException"/>
 public CapturingHttpClientHandler(IResources resources)
     : this(new ResponseStore(resources))
 {
 }
Example #10
0
        public List <IInteractionable> exec(IInteractionable requester, IInteractionable receiver)
        {
            receiver.GetFlota().ForEach((c) =>
            {
                destacamento.Add(c.GetId(), c.GetAmount());
            });
            receiver.GetDefensas().ForEach((c) =>
            {
                destacamento.Add(c.GetId(), c.GetAmount());
            });
            receiver.GetRecursos().ForEach((c) =>
            {
                recurso.Add(c.GetId(), c.GetAmount());
            });


            bool  requesterWin = FlotaAmount(receiver) == 0;
            float round        = 0;

            while (!requesterWin && FlotaAmount(requester) > 0)
            {
                System.Diagnostics.Debug.WriteLine("####Round" + round);
                round++;
                float receiverDice  = GetInitiative(receiver);
                float requesterDice = GetInitiative(requester);
                //restore shield
                FlotaAtacadaReceiver.ForEach((u) => { u.RestoreShield(); });
                FlotaAtacadaRequester.ForEach((u) => { u.RestoreShield(); });
                var FlotaRapidaRequester = requester.GetFlota().OrderBy(c => c.GetVelocidad() * c.GetAmount()).Where(c => c.GetAmount() != 0);
                var FlotaRapidaReceiver  = receiver.GetFlota().Concat(receiver.GetDefensas()).OrderBy(c => c.GetVelocidad() * c.GetAmount()).Where(c => c.GetAmount() != 0);;
                if (requesterDice >= receiverDice)
                {
                    FlotaRapidaRequester.ToList().ForEach((c) => {
                        PerformAttack(c, receiver, false);
                    });
                    FlotaRapidaReceiver.ToList().ForEach((c) => {
                        PerformAttack(c, requester, true);
                    });
                }
                else
                {
                    FlotaRapidaReceiver.ToList().ForEach((c) => {
                        PerformAttack(c, requester, true);
                    });
                    FlotaRapidaRequester.ToList().ForEach((c) => {
                        PerformAttack(c, receiver, false);
                    });
                }
                requesterWin = FlotaAmount(receiver) == 0;
            }
            if (requesterWin)
            {
                requester.Win();
                requester.GetFlota().ForEach((des) =>
                {
                    var capacidad = des.GetCapacidad() / receiver.GetRecursos().Count;
                    receiver.GetRecursos().ForEach((rec) =>
                    {
                        var setter = requester.GetRecursos().Where(c => c.GetId() == rec.GetId()).FirstOrDefault();
                        if (setter == null)
                        {
                            return;
                        }
                        if (rec.GetAmount() < capacidad)
                        {
                            setter.SetAmount(setter.GetAmount() + rec.GetAmount());
                            rec.SetAmount(0);
                        }
                        else
                        {
                            setter.SetAmount(setter.GetAmount() + capacidad);
                            rec.SetAmount(rec.GetAmount() - capacidad);
                        }
                    });
                });
                requester.Return();
            }
            else
            {
                receiver.Win();
            }

            destacamento.ToList().ForEach((r) => {
                IDestacamento defensa = receiver.GetDefensas().Where(c => c.GetId() == r.Key).FirstOrDefault();
                if (defensa != null)
                {
                    defensa.SetAmount(defensa.GetAmount() - r.Value);
                }
            });
            destacamento.ToList().ForEach((r) => {
                IDestacamento flota = receiver.GetFlota().Where(c => c.GetId() == r.Key).FirstOrDefault();
                if (flota != null)
                {
                    flota.SetAmount(flota.GetAmount() - r.Value);
                }
            });
            recurso.ToList().ForEach((r) => {
                IResources rec = receiver.GetRecursos().Where(c => c.GetId() == r.Key).FirstOrDefault();
                if (rec != null)
                {
                    rec.SetAmount(rec.GetAmount() - r.Value);
                }
            });
            receiver.SetMustUpdate(true);
            return(new List <IInteractionable> {
                requester, receiver
            });
        }
    public static GameEntity CreateEnemyDeath(this GameContext context, EnemyType enemyType, Vector2Int tilemapPosition, Vector2 pixelOffset, IResources resources)
    {
        var entity = context.CreateEntity();

        entity.isAutoDestroyedWhenAnimationEnds = true;
        entity.AddTilemapPosition(tilemapPosition);
        entity.AddPixelOffset(pixelOffset);
        entity.AddAnimationTime(Time.time);

        switch (enemyType)
        {
        default:
            entity.AddAnimation(resources.ballomDeath);
            break;
        }

        return(entity);
    }
Example #12
0
 public Unit(int identificationNumber, string nickName)
 {
     this.identificationNumber = identificationNumber;
     this.nickName             = nickName;
     this.resources            = new Resources();
 }
    public static GameEntity CreateExplosion(this GameContext context, int x, int y, int range, IResources resources)
    {
        var entity = context.CreateEntity();

        entity.isExploded = true;
        entity.isAutoDestroyedWhenAnimationEnds = true;
        entity.isWalkable = true;
        entity.AddFire(MoveDirections.All, range, Time.time);
        entity.AddTileId(new Vector2Int(x, y));
        entity.AddTilemapPosition(new Vector2Int(x, y));
        entity.AddTileAnimationAsset(resources.explosionCenterTileAnimation);
        entity.AddAnimationTime(Time.time);

        return(entity);
    }
    public static GameEntity CreateRightExplosion(this GameContext context, int x, int y, int range, IResources resources)
    {
        var entity = context.CreateBaseExplosion(x, y, range);

        entity.AddFire(MoveDirections.Right, range, Time.time);
        entity.AddTileAnimationAsset(range >= 1 ? resources.explosionHorizontalTileAnimation : resources.explosionRightTileAnimation);
        return(entity);
    }
    public static GameEntity CreateBombermanDeath(this GameContext context, Vector2Int tilemapPosition, Vector2 pixelOffset, IResources resources)
    {
        var entity = context.CreateEntity();

        entity.isAutoDestroyedWhenAnimationEnds = true;
        entity.AddTilemapPosition(tilemapPosition);
        entity.AddPixelOffset(pixelOffset);
        entity.AddAnimation(resources.bombermanDeath);
        entity.AddAnimationTime(Time.time);

        return(entity);
    }
    public static GameEntity CreatePowerup(this GameContext context, PowerupType powerupType, Vector2Int position, IResources resources)
    {
        if (powerupType == PowerupType.Door)
        {
            return(context.CreateDoor(position, resources));
        }

        var entity = context.CreateEntity();

        entity.isFlamable = true;
        entity.isWalkable = true;
        entity.AddPowerup(powerupType);
        entity.AddTileId(position);
        entity.AddTilemapPosition(position);

        switch (powerupType)
        {
        case PowerupType.Fire:
            entity.AddTileAsset(resources.firePowerupTile);
            break;

        case PowerupType.Bomb:
            entity.AddTileAsset(resources.bombPowerupTile);
            break;

        case PowerupType.Detonator:
            entity.AddTileAsset(resources.detonatorPowerupTile);
            break;

        case PowerupType.Speedup:
            entity.AddTileAsset(resources.speedupPowerupTile);
            break;

        case PowerupType.BombWalk:
            break;

        case PowerupType.WallWalker:
            break;

        case PowerupType.FlameProof:
            break;

        case PowerupType.Mystery:
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(powerupType), powerupType, null);
        }

        return(entity);
    }
 public StartGameSystem(Contexts contexts)
 {
     _context   = contexts.game;
     _resources = contexts.config.resources.value;
 }
Example #18
0
 public bool IsEqualTo(IResources resource)
 {
     return resource.GoldCoins == this.goldCoins &&
         resource.SilverCoins == this.silverCoins &&
         resource.BronzeCoins == this.bronzeCoins;
 }
    public static GameEntity CreateDoor(this GameContext context, Vector2Int position, IResources resources)
    {
        var entity = context.CreateEntity();

        entity.isDoor     = true;
        entity.isFlamable = true;
        entity.isWalkable = true;
        entity.AddTileId(position);
        entity.AddTilemapPosition(position);
        entity.AddTileAsset(resources.doorTile);
        return(entity);
    }
Example #20
0
 public Day5(IResources adventResources) : base(adventResources)
 {
 }
        public CommandHandler(CommandService commandService, DiscordSocketClient client, CustomCommandHandler customCommandHandler,
                              InjhinuityInstance injhinuity, IOwnerLogger ownerLogger, IResources resources,
                              IEmbedPayloadFactory embedPayloadFactory, IEmbedService embedService /*, FoolsService foolsService
                                                                                                    * ConversationHandler conversationHandler, IPollService pollService*/)
        {
            _log = LogManager.GetCurrentClassLogger();

            _client               = client;
            _commandService       = commandService;
            _injhinuity           = injhinuity;
            _ownerLogger          = ownerLogger;
            _customCommandHandler = customCommandHandler;
            _resources            = resources;
            _embedPayloadFactory  = embedPayloadFactory;
            _embedService         = embedService;
            //_foolsService = foolsService;
            //_conversationHandler = conversationHandler;
            //_pollService = pollService;
        }
Example #22
0
 public HomeController(UserManager <OrgUser> userManager, SignInManager <OrgUser> signInManager, IConfiguration config, HostingEnvironment hostingEnvironment, IResources resources, IApppSettings appSettings, IDataProvider dataProvider, IDetection detection, IAppMailer appMailer) :
     base(userManager, signInManager, config, hostingEnvironment, resources, appSettings, dataProvider, detection, appMailer)
 {
 }
Example #23
0
 public BookController(IOptionsSnapshot <ApiRequestUri> options, IHttpContextAccessor _httpContext, IResources resources) : base(_httpContext.HttpContext)
 {
     _apiRequestUri = options.Value;
     _HttpContext   = _httpContext;
     _resourses     = resources;
 }
 public UserBooksWebController(IOptionsSnapshot <ApiRequestUri> options, IHttpContextAccessor _httpContext, IResources resource, IHostingEnvironment appEnvironment) : base(_httpContext.HttpContext)
 {
     _resource       = resource;
     _appEnvironment = appEnvironment;
     _apiRequestUri  = options.Value;
     _HttpContext    = _httpContext;
 }
 public MockedTeleportStation(IBusinessOwner owner, IEnumerable<IPath> galacticMap, ILocation location)
     : base(owner, galacticMap, location)
 {
     resources = new Resources();
 }
Example #26
0
    public override void Init()
    {
        /*
         * IEventHandler h = App.On(ApplicationEvents.ON_INITED,(sender,e)=>{
         *
         *  Debug.Log("9123891237012897312");
         * });
         *
         * IEventHandler aa = App.On(ApplicationEvents.ON_INITED,(sender,e)=>{
         *
         *  Debug.Log("aksldjalkds9123891237012897312");
         * });
         *
         * IEventHandler bb = App.On(ApplicationEvents.ON_INITED,(sender,e)=>{
         *
         *  Debug.Log("ooooooooo9123891237012897312");
         * });*/


        App.On(ApplicationEvents.ON_APPLICATION_START_COMPLETE, (sender, e) =>
        {
            IEnv env       = App.Make <IEnv>();
            IIOFactory fac = App.Make <IIOFactory>();
            IDisk disk     = fac.Disk();

            IFile fff = disk.File(env.ResourcesNoBuildPath + System.IO.Path.AltDirectorySeparatorChar + "csv" + System.IO.Path.AltDirectorySeparatorChar + "csv.csv");

            string ssss = System.Text.Encoding.UTF8.GetString(fff.Read());

            /*
             * string[] ss2 = ssss.Split(new string[]{ System.Environment.NewLine}, System.StringSplitOptions.RemoveEmptyEntries );
             *
             * foreach(var ss in ss2){
             * Debug.Log(ss);
             * }
             *
             * return;*/

            ICsvParser csvParser = App.Make <ICsvParser>();

            string[][] parser = csvParser.Parser(ssss);

            foreach (string[] s in parser)
            {
                Debug.Log(s[0] + "|" + s[1] + "|" + s[2]);
            }

            return;

            IProtobuf protobuf = App.Make <IProtobuf>();

            var person = new TestProto.Person
            {
                Id      = 12345,
                Name    = "Fred",
                Address = new TestProto.Address
                {
                    Line1 = "Flat 1",
                    Line2 = "The Meadows"
                }
            };

            byte[] data = protobuf.Serializers(person);

            Debug.Log(data.Length);

            var p = protobuf.UnSerializers <TestProto.Person>(data);

            Debug.Log(p.Name);

            IFile file     = disk.File("hello.gz");
            ICompress comp = App.Make <ICompress>();
            byte[] byt     = comp.Compress("helloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworld".ToByte());

            Debug.Log("UnCompress: " + "helloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworldhelloworld".ToByte().Length);
            Debug.Log("Compress: " + byt.Length);
            //file.Create(byt);

            byt = comp.UnCompress(byt);
            Debug.Log(System.Text.Encoding.UTF8.GetString(byt));

            //byte[] debyt = comp.Expand(byt);

            //Debug.Log(System.Text.Encoding.UTF8.GetString(debyt));


            IJson json = App.Make <IJson>();

            Foos ff    = new Foos();
            ff.Value   = 100;
            ff.Value2  = "123";
            ff.SubList = new List <Foosub>();
            ff.SubList.Add(new Foosub()
            {
                Hello = 10, IsTrue = true
            });
            ff.SubList.Add(new Foosub()
            {
                Hello = 20, IsTrue = true
            });
            ff.SubList.Add(new Foosub()
            {
                Hello = 30, IsTrue = false
            });

            Debug.Log(json.Encode(ff));

            Foos f = json.Decode <Foos>(json.Encode(ff));
            Debug.Log(f.Value2);
            foreach (Foosub sb in f.SubList)
            {
                Debug.Log(sb.Hello);
            }

            //Debug.Log(f.Value);


            ITranslator tran = App.Make <ITranslator>();
            Debug.Log(tran.Trans("test.messages3"));
            Debug.Log(tran.Trans("test.messages3", "age:18", "name", "anny"));
            Debug.Log(tran.Trans("test.message", "name:anny"));
            Debug.Log(tran.TransChoice("test.messages", 0, "name", "喵喵"));
            Debug.Log(tran.TransChoice("test.messages", 12, "name", "miaomiao"));
            Debug.Log(tran.TransChoice("test.messages", 20, "name", "miaomiao"));
            tran.SetLocale("en");
            Debug.Log(tran.Trans("test.message", "name", "喵喵"));


            //IEnv env = App.Make<IEnv>();
            //IDisk disk = App.Make<IIOFactory>().Disk();
            //IINIResult result = App.Make<IINILoader>().Load(disk.File(env.ResourcesNoBuildPath + System.IO.Path.AltDirectorySeparatorChar + "/lang/cn/test.ini"));
            //result.Set("helloworld", "mynameisyb", "yb");
            //result.Remove("myname");
            //result.Save();


            IResources res = App.Make <IResources>();

            /*res.LoadAsync("prefab/asset6/test-prefab",(a)=>
             * {
             *  a.Instantiate();
             * });
             * res.LoadAsync("prefab/asset6/test-prefab2", (a) =>
             * {
             *  a.Instantiate();
             * });*/
            //var b = res.Load<Object>("prefab/asset6/test-prefab");
            res.LoadAsync("prefab/asset6/test-prefab", (aa) =>
            {
                var dd = aa.Instantiate();

                App.Make <ITimeQueue>().Task(() =>
                {
                    Debug.Log("now destroy 1 prefab");
                    GameObject.Destroy(dd);
                }).Delay(20).Play();
            });
            //var a = res.Load("prefab/asset6/test-prefab2");
            //GameObject obj = a.Instantiate();
            //GameObject.Instantiate(obj); //绕过控制克隆

            /*App.Make<ITimeQueue>().Task(() =>
             * {
             *
             *  Debug.Log("now destroy 1 prefab");
             *  GameObject.Destroy(obj);
             *
             * }).Delay(10).Play();*/

            /*
             * IResources res = App.Make<IResources>();
             * res.LoadAsync<GameObject>("prefab/asset6/test-prefab", (obj) =>
             * {
             *  Object.Instantiate(obj);
             * });
             *
             * //h.Cancel();
             *
             * //App.Event.Trigger(ApplicationEvents.ON_INITED);
             *
             * //Debug.Log(App.Make(typeof(Test).ToString(),"123"));
             *
             * //IHash hash = App.Make<IHash>();
             * //Debug.Log(hash.Bcrypt("helloworld"));
             *
             * //ICrypt secret = App.Make<ICrypt>();
             * //string code = secret.Encrypt("helloworld");
             * //Debug.Log(code);
             *
             * //Debug.Log(secret.Decrypt(code));
             *
             * /*FThread.Instance.Task(() =>
             * {
             *  Debug.Log("pppppppppppppppppppp");
             *  int i = 0;
             *  i++;
             *  return i;
             * }).Delay(5).Start().Cancel();
             */
            //Debug.Log(hash.BcryptVerify("helloworld", "$2a$10$Y8BxbHFgGArGVHIucx8i7u7t5ByLlSdWgWcQc187hqFfSiKFJfz3C"));
            //Debug.Log(hash.BcryptVerify("helloworld", "$2a$15$td2ASPNq.8BXbpa6yUU0c.pQpfYLxtcbXviM8fZXw4v8FDeO3hCoC"));


            //IAssetBundle bundle = App.Make<IAssetBundle>();
            //Object.Instantiate(res.Load<GameObject>("prefab/asset6/test-prefab.prefab"));

            //Object[] p = res.LoadAll("prefab/asset6");
            //IResources res = App.Make<IResources>();

            /*res.LoadAsync<GameObject>("prefab/asset6/test-prefab", (obj) =>
             * {
             *   Object.Instantiate(obj);
             * });*/
            //res.UnloadAll();
            //Object.Instantiate(res.Load<GameObject>("prefab/asset6/test-prefab.prefab"));

            /*
             * Thread subThread = new Thread(new ThreadStart(() => {
             *
             *  App.MainThread(() => { new GameObject(); });
             *
             * }));
             *
             * FThread.Instance.Task(() =>
             * {
             *  int i = 0;
             *  i++;
             *  return i;
             * }).Delay(5).OnComplete((obj) => Debug.Log("sub thread complete:" + obj)).Start();
             *
             * subThread.Start();
             *
             */
            /*
             * ITimeQueue timeQueue = App.Make<ITimeQueue>();
             *
             * ITimeTaskHandler h = timeQueue.Task(() =>
             * {
             *  Debug.Log("this is in task");
             * }).Delay(3).Loop(3).Push();
             *
             *
             * timeQueue.Task(() =>
             * {
             *  Debug.Log("2222222");
             * }).Delay(1).Loop(3).OnComplete(()=> { h.Cancel(); Debug.Log("2 complete"); }).Push();
             *
             * timeQueue.Task(() =>
             * {
             *  Debug.Log("rand!");
             * }).Loop(() => { return Random.Range(0,100) > 10; }).Push();
             *
             * timeQueue.OnComplete(() =>
             * {
             *  Debug.Log("queueComplete");
             * });
             *
             * timeQueue.Play(); */
            /*
             *
             *          FThread.Instance.Task(() =>
             *          {
             *              Debug.Log("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
             *              //Debug.Log(App.Time.Time);
             *              timeQueue.Replay();
             *
             *          }).Delay(9).Start();*/


            App.On(HttpRequestEvents.ON_MESSAGE + typeof(IConnectorHttp).ToString(), (obj1, obj2) =>
            {
                Debug.Log((obj2 as IHttpResponse).Text);
                Debug.Log((obj2 as IHttpResponse).IsError);
                Debug.Log((obj2 as IHttpResponse).Error);
            });

            IConnectorHttp http = FNetwork.Instance.Create <IConnectorHttp>("http");
            //http.SetConfig(new System.Collections.Hashtable() { { "host", "http://www.qidian.com/" } });
            http.Get(string.Empty);


            App.On(SocketRequestEvents.ON_MESSAGE + typeof(IConnectorSocket).ToString(), (obj1, obj2) =>
            {
                if ((obj2 as PackageResponseEventArgs).Response.Package is string)
                {
                    Debug.Log((obj2 as PackageResponseEventArgs).Response.Package as string);
                }
                else
                {
                    Debug.Log(Encoding.UTF8.GetString(((obj2 as PackageResponseEventArgs).Response.Package as byte[])));
                }
            });

            App.On(SocketRequestEvents.ON_CONNECT, (obj1, obj2) =>
            {
                Debug.Log("on connect");
            });


            App.On(SocketRequestEvents.ON_ERROR, (obj1, obj2) =>
            {
                Debug.Log("on tcp error:" + (obj2 as ErrorEventArgs).Error.Message);
            });

            //链接配置见 NetworkConfig 配置文件

            IConnectorTcp tcpConnect = FNetwork.Instance.Create <IConnectorTcp>("tcp.text");


            (tcpConnect as IEvent).Event.One(SocketRequestEvents.ON_MESSAGE, (s1, e1) =>
            {
                Debug.Log((e1 as PackageResponseEventArgs));
                if ((e1 as PackageResponseEventArgs).Response.Package is string)
                {
                    Debug.Log((e1 as PackageResponseEventArgs).Response.Package as string);
                }
                else
                {
                    Debug.Log(Encoding.UTF8.GetString(((e1 as PackageResponseEventArgs).Response.Package as byte[])));
                }
            });


            tcpConnect.Connect();
            tcpConnect.Send("hello this is tcp msg with [text]".ToByte());


            IConnectorTcp tcpConnect2 = FNetwork.Instance.Create <IConnectorTcp>("tcp.frame");
            tcpConnect2.Connect();
            tcpConnect2.Send("hello this is tcp msg with [frame]".ToByte());

            /*
             * IConnectorUdp udpConnect = FNetwork.Instance.Create<IConnectorUdp>("udp.bind.host.text");
             * udpConnect.Connect();
             * udpConnect.Send("hello this is udp msg with [text]".ToByte());
             *
             *
             * IConnectorUdp udpConnectFrame = FNetwork.Instance.Create<IConnectorUdp>("udp.bind.host.frame");
             * udpConnectFrame.Connect();
             * udpConnectFrame.Send("hello this is udp msg with [frame]".ToByte());*/


            IConnectorUdp udpConnect2 = FNetwork.Instance.Create <IConnectorUdp>("udp.unbind.host.frame");
            udpConnect2.Connect();
            udpConnect2.Send("hello world(client udp)".ToByte(), "pvp.gift", 3301);
        });
    }
Example #27
0
 public VersionCheckMenu(IPackageComparer packageComparer, IResources resources, IVersionCheckConfiguration versionCheckConfiguration)
 {
     _packageComparer           = packageComparer;
     _resources                 = resources;
     _versionCheckConfiguration = versionCheckConfiguration;
 }
Example #28
0
 public OnlineUpdate(IUpdateSetting settings, IResources resources)
 {
     Settings = settings;
     R        = resources;
 }
Example #29
0
 public LoggingModule(IDiscordModuleService discordModuleService, IBotConfig botConfig, IEmbedService embedService,
                      IEmbedPayloadFactory embedPayloadFactory, IResources resources)
     : base(botConfig, discordModuleService, embedService, embedPayloadFactory, resources)
 {
 }
 public ExtraMetaFiles (Book book, INamingAndModeSettings settings, IResources resources) {
   Book = book;
   Settings = settings;
   _resources = resources;
 }
 public PeriodIncomeBuilding(string name, IResources price, int workers, IResources[] incomes)
     : base(name, price, workers, incomes) { }
Example #32
0
 public bool CanPay(IResources cost)
 {
     return this.resources.GoldCoins >= cost.GoldCoins &&
         this.resources.SilverCoins >= cost.SilverCoins &&
         this.resources.BronzeCoins >= cost.BronzeCoins;
 }
 public void Add(IResources payment)
 {
     this.bronzeCoins += payment.BronzeCoins;
     this.silverCoins += payment.SilverCoins;
     this.goldCoins   += payment.GoldCoins;
 }
Example #34
0
            public Game(INavigationService <ILevel> navigationService, IAccelerometer accelerometer, IResources resources, ITimer timer)
            {
                NavigationService = navigationService;
                Accelerometer     = accelerometer;
                Resources         = resources;
                Timer             = timer;

                Timer.OnUpdate += this.Update;
                Timer.OnDraw   += this.Draw;
            }
Example #35
0
 public static void SetResourceLoader(IResources resources)
 {
     _resources = resources;
 }
Example #36
0
 public void Add(IResources payment)
 {
     this.bronzeCoins += payment.BronzeCoins;
     this.silverCoins += payment.SilverCoins;
     this.goldCoins += payment.GoldCoins;
 }
Example #37
0
 //constructor
 public PatientService(HospitalDbContext context, IResources resources)
 {
     _context   = context;
     _resources = resources;
 }
Example #38
0
 public ResourcesController(IResources resourcesService)
 {
     _resourcesService = resourcesService;
 }
 public HelpModule(IHelpService helpService, IBotConfig botConfig, IEmbedService embedService,
                   IEmbedPayloadFactory embedPayloadFactory, IResources resources)
     : base(botConfig, embedService, embedPayloadFactory, resources)
 {
     _helpService = helpService;
 }
 public bool IsEqualTo(IResources resource)
 {
     return(resource.GoldCoins == this.goldCoins &&
            resource.SilverCoins == this.silverCoins &&
            resource.BronzeCoins == this.bronzeCoins);
 }
    IEnumerator _CorDownload()
    {
        this.downloading = true;
        try
        {
            if (downloadProgressEvent != null)
            {
                downloadProgressEvent(0);
            }
            // 下载 Manifest
            IProgressResult <Progress, BundleManifest> manifestResult = this.downloader.DownloadManifest(BundleSetting.ManifestFilename);
            yield return(manifestResult.WaitForDone());

            if (manifestResult.Exception != null)
            {
                LogManager.Log("Downloads BundleManifest failure.Error:{0}", manifestResult.Exception);
                yield break;
            }

            // 下载 BundleInfo
            BundleManifest manifest = manifestResult.Result;
            IProgressResult <float, List <BundleInfo> > bundlesResult = this.downloader.GetDownloadList(manifest);
            yield return(bundlesResult.WaitForDone());

            List <BundleInfo> bundles = bundlesResult.Result;
            if (bundles == null || bundles.Count <= 0)
            {
                LogManager.Log("Please clear cache and remove StreamingAssets,try again.");
                yield break;
            }

            // 下载 Bundle
            IProgressResult <Progress, bool> downloadResult = this.downloader.DownloadBundles(bundles);
            downloadResult.Callbackable().OnProgressCallback(p =>
            {
                LogManager.Log("Downloading {0:F2}KB/{1:F2}KB {2:F3}KB/S", p.GetCompletedSize(UNIT.KB), p.GetTotalSize(UNIT.KB), p.GetSpeed(UNIT.KB));
                float percent = p.GetCompletedSize(UNIT.KB) / p.GetTotalSize(UNIT.KB);
                if (downloadProgressEvent != null)
                {
                    downloadProgressEvent(percent);
                }
            });
            yield return(downloadResult.WaitForDone());

            if (downloadResult.Exception != null)
            {
                LogManager.Log("Downloads AssetBundle failure.Error:{0}", downloadResult.Exception);
                yield break;
            }

            // 下载成功
            LogManager.Log(" 下载成功 ");
            IResources _resources = CreateResources();
            context.GetContainer().Unregister <IResources>();
            context.GetContainer().Register <IResources>(_resources);

#if UNITY_EDITOR
            UnityEditor.EditorUtility.OpenWithDefaultApp(BundleUtil.GetStorableDirectory());
#endif
        }
        finally
        {
            this.downloading = false;
        }
    }