Пример #1
0
 public LandlordController(IEstateHandler _estateHandler, IUserHandler uhandler, IRulesetHandler rhandler, IHousingHandler lHandler)
 {
     this.estateHandler  = _estateHandler;
     this.userHandler    = uhandler;
     this.rulesetHandler = rhandler;
     this.handler        = lHandler;
 }
Пример #2
0
        async Task HandleEstate(HttpContext ctx, HttpRequest req, IEstateHandler estate)
        {
            req.Headers.TryGetValue("Platform", out var platform);
            req.Headers.TryGetValue("Pack", out var pack);
            // DATA
            if (req.Uri.StartsWith("/d/"))
            {
                var res = new HttpResponse(200, "OK");
                var val = req.Uri.Substring(3);
                _asyncRes.Value = res;
                var dataPack = await _cache.GetOrCreateAsync($"d:{pack}", async x => await estate.DataPackFunc(new Uri(pack), () => _asyncRes.Value));

                if (val == ".set")
                {
                    dataPack.SinkDataContains();
                }
                else
                {
                    await dataPack.LoadDataLabelAsync(val);
                }
                res.Headers.Add("Content-Type", "text/html");
                res.Headers.Add("Cache-Control", "no-cache");
                res.Headers.Add("Connection", "close");
                await ctx.ResponseChannel.Send(res, ctx.Token)
                .ContinueWith(t => ctx.ResponseChannel.Close());
            }
            // ASSET
            else
            {
                var res = new HttpResponse(200, "OK");
                var val = req.Uri.Substring(1);
                _asyncRes.Value = res;
                var assetPack = await _cache.GetOrCreateAsync($"a:{pack}", async x => await estate.AssetPackFunc(new Uri(pack), () => _asyncRes.Value));

                if (val == ".set")
                {
                    assetPack.GetContainsSet();
                }
                else
                {
                    await assetPack.LoadFileDataAsync(val);
                }
                res.Headers.Add("Content-Type", "text/html");
                res.Headers.Add("Cache-Control", "no-cache");
                res.Headers.Add("Connection", "close");
                await ctx.ResponseChannel.Send(res, ctx.Token)
                .ContinueWith(t => ctx.ResponseChannel.Close());
            }
        }
Пример #3
0
        public SimpleEngine(IEstateHandler handler, IAssetPack assetPack, IDataPack dataPack)
        {
            if (handler == null)
            {
                throw new ArgumentNullException(nameof(handler));
            }
            AssetPack   = assetPack ?? throw new ArgumentNullException(nameof(assetPack));
            DataPack    = dataPack ?? throw new ArgumentNullException(nameof(dataPack));
            CellManager = handler.CellManagerFunc(LoadBalancer, assetPack, dataPack, null) ?? throw new ArgumentNullException(nameof(handler.CellManagerFunc));

            // ambient
            RenderSettings.ambientMode      = UnityEngine.Rendering.AmbientMode.Flat;
            RenderSettings.ambientIntensity = AmbientIntensity;

            // sun
            _sunObj = GameObjectUtils.CreateDirectionalLight(Vector3.zero, Quaternion.Euler(new Vector3(50, 330, 0)));
            _sunObj.GetComponent <Light>().shadows = RenderSunShadows ? LightShadows.Soft : LightShadows.None;
            _sunObj.SetActive(false);
            if (DayNightCycle)
            {
                _sunObj.AddComponent <DayNightCycle>();
            }

            //// water
            //_waterObj = GameObject.Instantiate(TesGame.instance.WaterPrefab);
            //_waterObj.SetActive(false);
            //var water = _waterObj.GetComponent<Water>();
            //water.waterMode = game.instance.WaterQuality;
            //if (!TesGame.instance.WaterBackSideTransparent)
            //{
            //    var side = _waterObj.transform.GetChild(0);
            //    var sideMaterial = side.GetComponent<Renderer>().sharedMaterial;
            //    sideMaterial.SetInt("_SrcBlend", (int)UnityEngine.Rendering.BlendMode.One);
            //    sideMaterial.SetInt("_DstBlend", (int)UnityEngine.Rendering.BlendMode.Zero);
            //    sideMaterial.SetInt("_ZWrite", 1);
            //    sideMaterial.DisableKeyword("_ALPHATEST_ON");
            //    sideMaterial.DisableKeyword("_ALPHABLEND_ON");
            //    sideMaterial.DisableKeyword("_ALPHAPREMULTIPLY_ON");
            //    sideMaterial.renderQueue = -1;
            //}

            //Cursor.SetCursor(Asset.LoadTexture("tx_cursor", 1), Vector2.zero, CursorMode.Auto);
        }
Пример #4
0
 public SimpleEngine(IEstateHandler handler, Uri assetPack, Uri dataPack) : this(handler, handler?.AssetPackFunc(assetPack, null).Result, handler?.DataPackFunc(dataPack, null).Result)
 {
 }
Пример #5
0
 public UserController(IUserHandler handler, IHousingHandler _handler, IEstateHandler _estateHandler)
 {
     this.handler        = handler;
     this.HousingHandler = _handler;
     this.estateHandler  = _estateHandler;
 }
Пример #6
0
 public EstateController(IEstateHandler handler)
 {
     this.handler = handler;
 }
Пример #7
0
 public HomeController(ILogger <HomeController> logger, IUserHandler handler, IEstateHandler eHandler)
 {
     _logger            = logger;
     this.handler       = handler;
     this.estateHandler = eHandler;
 }