Example #1
0
 public CanHaveSourcesNode(ITreeNode trueNode, ITreeNode falseNode, GetPrice getPrice, IMapController map)
     : base(trueNode, falseNode, null)
 {
     this.getPrice = getPrice;
     condition = Condition;
     this.map = map;
 }
Example #2
0
 public FortShowParade(IMapController map, double kHasSources, double kPointsToWin, int depth)
     : base(map, depth, "Show Parade")
 {
     double sum = kHasSources + kPointsToWin;
     this.kHasSources = kHasSources / sum;
     this.kPointsToWin = kPointsToWin / sum;
 }
Example #3
0
        /// <inheritdoc />
        public async ValueTask <IMapController> CreateMap(int serverId, int mapId)
        {
            IMapController mapController = null;

            try
            {
                var appId = this.GenerateMapAppIdentifier(serverId, mapId);
                await this.jsRuntime.InvokeVoidAsync("CreateMap", serverId, mapId, this.GetMapContainerIdentifier(serverId, mapId), appId);

                var gameServer = this.serverService.GetGameServer(serverId);
                mapController = new MapController(this.jsRuntime, appId, gameServer, mapId);
                gameServer.RegisterMapObserver((ushort)mapId, mapController);
            }
            catch
            {
                if (mapController != null)
                {
                    await mapController.DisposeAsync();
                }

                throw;
            }

            return(mapController);
        }
Example #4
0
 public override void InstantiationAction(IMapController mapController)
 {
     if (_bullet == null || _bullet.IsDead())
     {
         SpawnBullet(mapController);
     }
 }
Example #5
0
    public void Init(LootData _itemData, IMapController map, IEntityController entityController)
    {
        _map = map;
        _entityController = entityController;

        _entityController.OnMonsterKilled += OnMonsterKilled;
    }
        private async void Awake()
        {
            var initTaskCompletion = new TaskCompletionSource <bool>();

            _initTask = initTaskCompletion.Task;

            if (node == null)
            {
                Debug.LogError($"{nameof(MapNodeBase)} not set in {nameof(NodeEffectsManager)} {name}!");
                initTaskCompletion.SetResult(true);
                return;
            }

            node.OnStateChanged += OnNodeStateChanged;

            // Get the WorldMap, async in case it's Awake runs after this, or it's loaded at runtime
            const float mapControllerTimeout = 0.2f; // Arbitrary short time, just to give MapController a chance to load

            _mapController = await MapDependencyContainer.ResolveAsync <IMapController>(mapControllerTimeout);

            if (_mapController == null)
            {
                initTaskCompletion.SetResult(false);
                return;
            }

            _mapController.OnZoomed      += OnZoomedIn;
            _mapController.OnNodeClicked += OnNodeClicked;
            initTaskCompletion.SetResult(true);
        }
Example #7
0
 public BuildRoad(IMapController map, int k, int depth)
     : base(map, depth, "Build road")
 {
     kPoints = k / 1000.0f;
     kCantBuildTown = 1.0f - kPoints;
     lastBestRoad = null;
 }
Example #8
0
 private void Awake()
 {
     _mapController   = gameObject.GetComponent <IMapController>();
     _tankController  = gameObject.GetComponent <ITankController>();
     _inputController = gameObject.GetComponent <IInputController>();
     _enemyController = gameObject.GetComponent <IEnemyController>();
 }
Example #9
0
        public FruitTree(BuildingDef def, string layerName, MapSpot anchor, IMapController controller, MapRotation rotation) : base(def, layerName, anchor, controller, rotation)
        {
            _stageLengths = new List <Dictionary <string, int> >();
            _stageLengths.Add(new Dictionary <string, int> {
                { "HOUR", 1 }
            });
            _stageLengths.Add(new Dictionary <string, int> {
                { "HOUR", 1 }
            });
            _stageLengths.Add(new Dictionary <string, int> {
                { "HOUR", 1 }
            });

            var outputConfif = new InventoryConfig()
            {
                CanProvideItems    = true,
                CanReceiveItems    = false,
                HasMassLimit       = false,
                MaxMass            = -1,
                RespectsStackLimit = false
            };

            var timeKeeper = GameMaster.Instance.GetController <ITimeKeeper>();

            _timeKeeper      = timeKeeper;
            _finishDate      = timeKeeper.ProjectTime(_stageLengths[0]);
            _outputInventory = new DefaultInventory(GameMaster.Instance.GetController <IItemController>(), this, outputConfif);
        }
Example #10
0
        private void HideMap(object sender, CancelEventArgs e)
        {
            IMapController mapController = GetComponent <MapController>();

            mapController.GETMapView().setGameObjectVisibility(false);
            mapController.GETMapView().DisableRadial();
        }
Example #11
0
        public void InitAIComponent(IMapController mapController, int[][] koef)
        {
            this.mapController = mapController;
            Desirability.SetMapController(mapController);

            thinkGoal = new ThinkGoal(mapController, koef, 0);
        }
Example #12
0
 private static WorldScreen CreateWorldScreen(CharacterSpriteMock player, IMapController mapController, ScreenConstants screenConstants = null)
 {
     if(screenConstants == null)
         screenConstants = new ScreenConstants();
     var loaderMock = new Mock<ISpriteLoader>();
     loaderMock.Setup(o => o.GetSprite(It.IsAny<string>())).Returns(player);
     return new WorldScreen(mapController, loaderMock.Object, screenConstants);
 }
        public virtual void Init(IMapController mapController, INodeManager nodeManager)
        {
            _mapController = mapController;
            _nodeManager   = nodeManager;

            _mapController.OnNodeClicked += OnNodeClicked;
            _input.OnInputUpdate         += OnInput;
        }
Example #14
0
 public FortCaptureHexa(IMapController map, int k, int depth)
     : base(map, depth, "Capture hexa")
 {
     kPoints = k / 1000.0f;
     kCapture = 1 - kPoints;
     bestHexa = null;
     bestHexaIDs = new List<int>();
 }
Example #15
0
        private void ShowMap(object sender, GPSDataReceivedEventArgs e)
        {
            IMapController mapController = GetComponent <MapController>();

            mapController.GETMapView().setGameObjectVisibility(true);
            mapController.GETMapView().EnableRadial();
            mapController.GETMapView().ZoomIntoPoint(e.latitude, e.longitude);
        }
Example #16
0
 public RaiseSources(IMapController map, ISourceAll source, int depth)
     : base(map, depth, "Raise sources")
 {
     List<ISourceAll> sourceList = new List<ISourceAll>();
     sourceList.Add(source);
     this.source = sourceList;
     Init();
 }
Example #17
0
        public void InitAIComponent(IMapController mapController, int[][] koef)
        {
            this.mapController = mapController;
            Desirability.SetMapController(mapController);

            double [] koefhard = new double[] { 0.50753910, 0.69240258, 0.75383028, 0.005387260, 0.03888009, 0.31205954, 0.73031067, 0.38760135, 0.33115000, 0.85088233, 0.55350950, 0.39943568, 0.18883969, 0.41989920, 0.20405476, 0.34062831, 0.33398948, 0.71093270, 0.69218646 };
            thinkGoal = new ThinkGoal(mapController, koefhard, 0);
        }
Example #18
0
        public override void InstantiationAction(IMapController mapController)
        {
            var wasSpacePressed = Input.GetKeyDown(ConsoleKey.Spacebar);

            if (wasSpacePressed && (_bullet == null || _bullet.IsDead()))
            {
                SpawnBullet(mapController);
            }
        }
Example #19
0
        public BuildTown(IMapController map, double kNearestTown, double kTownItself, int depth)
            : base(map, depth, "Build Town")
        {
            lastBestTown = null;

            double sum = (kNearestTown + kTownItself);
            this.kNearestTown = kNearestTown / sum;
            this.kTownItself = kTownItself / sum;
        }
Example #20
0
        public DecisionTree(IMapController map, AIEasy ai)
        {
            actionSource = new List<ActionSource>();
            activeState = new ActiveState();

            this.map = map;
            this.ai = ai;

            BuildTree();
        }
Example #21
0
        public BaseMapStructure(MapStructDef def, string layerName, MapSpot anchor, IMapController controller, MapRotation rotation) : base(def)
        {
            MapController = controller ?? throw new ArgumentNullException(nameof(controller));
            Anchor        = anchor ?? throw new ArgumentNullException(nameof(anchor));
            MapLayerName  = layerName;

            _def = def ?? throw new ArgumentNullException(nameof(def));
            MapStructValidator.ValidateDef(def);
            _rotationMapping = MapStructHelper.FootprintToMapSpotsDictionary(def.Footprint, rotation, anchor);
        }
Example #22
0
    public void Init(IEntityController entityController, IMapController map, TimeController timeController, BaseGameEvents.MonsterEvents events, List <MonsterData> monsterData)
    {
        _timeController = timeController;
        _timeController.AddScheduledEntity(this);

        _entityController = entityController;
        _map           = map;
        _monsterEvents = events;
        _monsterData   = monsterData;
    }
Example #23
0
    public void Init(IMapController mapController, BaseEntityCreationData entityCreationData, BaseGameEvents gameEvents)
    {
        _mapController      = mapController;
        _entityCreationData = entityCreationData;
        _allEntities        = new List <BaseEntity>();
        _entitiesToAdd      = new List <BaseEntity>();
        _entitiesToRemove   = new List <BaseEntity>();

        _gameEvents = gameEvents;
    }
Example #24
0
        public BuildSourceBuilding(IMapController map, double kBuildingItself, double kHasSources, int depth)
            : base(map, depth, "Build Source Building")
        {
            double sum = kBuildingItself + kHasSources;

            this.kBuildingItself = kBuildingItself / sum;
            this.kHasSources = kHasSources / sum;

            lastBestTown = null;
            lastBestPos = 0;
        }
Example #25
0
        public InteractiveLocationController(
            IMapController mapController,
            IUnitsController unitsController,
            ICameraController cameraController)
        {
            _mapController    = mapController;
            _unitsController  = unitsController;
            _cameraController = cameraController;

            Initialize();
        }
Example #26
0
        public BuildTown(IMapController map, double kNearestTown, double kTownItself, double kPoints, int depth, BuildSourceBuilding buildingGoal)
            : base(map, depth, "Build Town")
        {
            lastBestTown = null;

            double sum = (kNearestTown + kTownItself + kPoints);
            this.kNearestTown = kNearestTown / sum;
            this.kTownItself = kTownItself / sum;
            this.kPoints = kPoints / sum;
            this.buildingGoal = buildingGoal;
        }
Example #27
0
 public ArmiesLayer(
     IGuiServices guiServices,
     IMapController mapController,
     IMapArmyGuiFactory armyGuiFactory,
     IMapRouteDrawer routeDrawer,
     ModalLayer modalLayer) : base(guiServices)
 {
     _mapController  = mapController;
     _armyGuiFactory = armyGuiFactory;
     _routeDrawer    = routeDrawer;
     _modalLayer     = modalLayer;
 }
Example #28
0
        private void SpawnBullet(IMapController mapController)
        {
            _bullet          = new EnemyBullet(Direction, 1, this);
            _bullet.Position = Position.Clone();
            DirectionalMovement.Move(Direction, _bullet.Position);
            var wasSpawned = mapController.Spawn(_bullet);

            if (!wasSpawned)
            {
                _bullet = null;
            }
        }
Example #29
0
 public CitiesLayer(
     IGuiServices guiServices,
     IMapController mapController,
     IMapCityGuiFactory cityGuiFactory,
     IMapRouteDrawer routeDrawer,
     ModalLayer modalLayer)
     : base(guiServices)
 {
     _mapController  = mapController;
     _cityGuiFactory = cityGuiFactory;
     _routeDrawer    = routeDrawer;
     _modalLayer     = modalLayer;
 }
Example #30
0
        public BuildFort(IMapController map, double kBestHexa, double kHasMoney, double kPoints, double kHasOtherFort, int depth)
            : base(map, depth, "Build fort")
        {
            this.kHasFort = 0.2;

            double sum = kBestHexa + kHasMoney + kPoints + kHasOtherFort;
            this.kBestHexa = kBestHexa / sum;
            this.kHasMoney = kHasMoney / sum;
            this.kPoints = kPoints / sum;
            this.kHasOtherFort = kHasOtherFort / sum;

            lastBestTown = null;
            lastBestPos = 0;
        }
Example #31
0
        public GameStatisticsWindow(
            IGuiServices guiServices,
            ITexts texts,
            ILegionInfo legionInfo,
            IMapController mapController,
            IPlayersRepository playersRepository) : base(guiServices)
        {
            _texts             = texts;
            _legionInfo        = legionInfo;
            _mapController     = mapController;
            _playersRepository = playersRepository;

            CreateElements();
        }
Example #32
0
        public BuildMonastery(IMapController map, double k, double kHasMonastery, int depth)
            : base(map, depth, "Build Monastery")
        {
            const double koef = 1000.0;

            k *= koef;
            kHasSources = k;
            k = (k - (int)kHasSources) * koef;
            kBestSource = k;
            k = (k - (int)kBestSource) * koef;
            kHexa = k;
            k = (k - (int)kHexa) * koef;
            kHasOtherMonastery = k;

            BaseInit(kHasMonastery);
        }
Example #33
0
 public MapGuiLayer(
     IGuiServices guiServices,
     IMapController mapController,
     ITexts texts,
     IPlayersRepository playersRepository,
     ILegionInfo legionInfo,
     ModalLayer modalLayer,
     ICommonGuiFactory commonGuiFactory) : base(guiServices)
 {
     _mapController     = mapController;
     _texts             = texts;
     _playersRepository = playersRepository;
     _legionInfo        = legionInfo;
     _modalLayer        = modalLayer;
     _commonGuiFactory  = commonGuiFactory;
 }
Example #34
0
        public BuildMonastery(IMapController map, double kHexa, double kHasSources, double kBestSource, double kHasOtherMonastery, double kPoints, int depth)
            : base(map, depth, "Build Monastery")
        {
            kHasMonastery = 0.2;

            double sum = kHexa + kHasSources + kBestSource + kHasOtherMonastery + kPoints;

            this.kHexa = kHexa / sum;
            this.kHasSources = kHasSources / sum;
            this.kBestSource = kBestSource / sum;
            this.kHasOtherMonastery = kHasOtherMonastery / sum;
            this.kPoints = kPoints / sum;

            lastBestTown = null;
            lastBestPos = 0;
        }
Example #35
0
        public BuildMarket(IMapController map, double kHexa, double kHasSources, double kBestSource, double kHasOtherMarket, double kPoints, int depth)
            : base(map, depth, "BuildMarket")
        {
            this.kHasMarket = 0.2;

            double sum = kHexa + kHasSources + kBestSource + kHasOtherMarket + kPoints;

            this.kHexa = kHexa / sum;
            this.kHasSources = kHasSources / sum;
            this.kBestSource = kBestSource / sum;
            this.kHasOtherMarket = kHasOtherMarket / sum;
            this.kPoints = kPoints / sum;

            lastBestTown = null;
            lastBestPos = 0;
        }
Example #36
0
        public BuildMarket(IMapController map, double k, double kHasMarket, int depth)
            : base(map, depth, "BuildMarket")
        {
            const double koef = 1000.0;

            k *= koef;
            kHasSources = k;
            k = (k - (int)kHasSources) * koef;
            kBestSource = k;
            k = (k - (int)kBestSource) * koef;
            kHexa = k;
            k = (k - (int)kHexa) * koef;
            kHasOtherMarket = k;

            BaseInit(kHasMarket);
        }
Example #37
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            _mapView = FindViewById<MapView>(Resource.Id.mapview);
            _mapView.SetTileSource(TileSourceFactory.DefaultTileSource);
            _mapView.SetBuiltInZoomControls(true);

            _mapController = _mapView.Controller;
            _mapController.SetZoom(25);

            var centreOfMap = new GeoPoint(51496994, -134733);
            _mapController.SetCenter(centreOfMap);
        }
Example #38
0
 public void Init(IEntityController entityController, IMapController mapController, BattleTraitData data, IBattleEntity owner, BaseGameEvents gameEvents)
 {
     _targets          = new List <IBattleEntity>();
     _data             = data;
     _entityController = entityController;
     _owner            = owner;
     _attacks          = new List <BaseAttack>();
     _currentAttackIdx = 0;
     _gameEvents       = gameEvents;
     _battleEvents     = gameEvents.Battle;
     foreach (var attackData in data.Attacks)
     {
         var attack = attackData.SpawnRuntime();
         attack.Init(entityController, mapController);
         _attacks.Add(attack);
     }
 }
Example #39
0
        private static MapEffectState GetState(IMapController mapController, IMapNode node)
        {
            if (!node.Available)
            {
                return(MapEffectState.Unavailable);
            }
            if (IsZoomedInOn(mapController, node))
            {
                return(MapEffectState.ZoomedIn);
            }
            if (IsHighlighted(node))
            {
                return(MapEffectState.Highlighted);
            }

            return(MapEffectState.Normal);
        }
Example #40
0
    protected virtual void Awake()
    {
        _input            = CreateInputController();
        _timeController   = new TimeController();
        _entityController = CreateEntityController();
        _mapController    = CreateMapController();
        _monsterCreator   = new MonsterCreator();
        _eventLogger      = CreateGameLogger();

        _result  = GameResult.None;
        _loading = false;

        InitPlayStates();
        InitPlayStateData();

        ExtendedInit();
    }
Example #41
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            _mapView = FindViewById <MapView>(Resource.Id.mapview);
            _mapView.SetTileSource(TileSourceFactory.DefaultTileSource);
            _mapView.SetBuiltInZoomControls(true);

            _mapController = _mapView.Controller;
            _mapController.SetZoom(25);

            var centreOfMap = new GeoPoint(51496994, -134733);

            _mapController.SetCenter(centreOfMap);
        }
        private void IsVisibleChangedEventHandler(object sender, DependencyPropertyChangedEventArgs e)
        {
            if ((bool)e.NewValue == true)
            {
                if (presenter != null)
                {
                    presenter.OnViewShow();
                }

                if (mapController == null)
                {
                    mapController = new MapBrowserController(this.webBrowser);
                    this.webBrowser.LoadCompleted += new LoadCompletedEventHandler(WebBrowserLoadCompleted);
                    Presenter.WorkItem.Items.Add(mapController);
                }
                else
                {
                    ShowRoute();
                }
            }
        }
Example #43
0
        public ThinkGoal(IMapController map, int[][] koef, int depth)
            : base(map, depth, "Think")
        {
            sumSources = 0;
            level = 0;
            coeficients = koef;

            if (koef == null)
            {
                koef = new int[11][];
                koef[0] = new int[4];
                koef[1] = new int[2];
                koef[2] = new int[4];
                koef[3] = new int[5];
                koef[4] = new int[2];
                koef[5] = new int[6];
                koef[6] = new int[6];
                koef[7] = new int[2];
                koef[8] = new int[2];
                koef[9] = new int[2];
                koef[10] = new int[2];

                koef[0] = new int[] { 1, 300, 500, 100 };
                koef[1] = new int[] {4, 100};
                koef[2] = new int[] {1, 200, 100, 200};
                koef[3] = new int[] {1, 2, 3, 4, 5};
                koef[4] = new int[] {1, 200};
                koef[5] = new int[] {1, 2, 3, 4, 5, 6};
                koef[6] = new int[] {1, 2, 3, 4, 5, 6};
                koef[7] = new int[] {1, 100};
                koef[8] = new int[] {1, 200};
                koef[9] = new int[] {2, 300};
                koef[10] = new int[] {3, 100};

                coeficients = koef;
            }

            AddMainGoals();
        }
Example #44
0
        public BuildFort(IMapController map, double k, double kHasFort, int depth)
            : base(map, depth, "Build fort")
        {
            this.kHasFort = kHasFort;

            const double koef = 1000.0;

            k *= koef;
            kHasMoney = k;
            k = (k - (int) kHasMoney) * koef;
            kPointsToWin = k;
            k = (k - (int) kPointsToWin) * koef;
            kBestHexa = k;
            k = (k - (int) kBestHexa) * koef;
            kHasOtherFort = k;

            double sum = kBestHexa + kHasMoney + kPointsToWin + kHasOtherFort;
            kBestHexa = kBestHexa / sum;
            kHasMoney = kHasMoney / sum;
            kPointsToWin = kPointsToWin / sum;
            kHasOtherFort = kHasOtherFort / sum;
        }
Example #45
0
        private void SearchClicked(object sender, BackEventArgs e)
        {
            Debug.Log(myLocation);

            if (!alreadyfetched)
            {
                var query = CineastUnityInterface.Runtime.Vitrivr.UnityInterface.CineastApi.Utils.QueryBuilder
                            .BuildSpatialSimilarityQuery(myLocation.getLat(), myLocation.getLon());
                QueryCineastAndProcess(query, false);
                alreadyfetched = true;
            }
            else
            {
                setFetchedActiveList();
            }
            IResultPanelModel   resultPanelModel = transform.GetComponent <ResultPanelController>().GETResultPanelModel();
            IMainMenuController menuController   = GetComponent <MainMenuController>();

            IResultPanelView resultPanelView = transform.GetComponent <ResultPanelController>().GETResultPanelView();
            Vector3          newpos          = new Vector3(Camera.main.transform.position.x, Camera.main.transform.position.y, Camera.main.transform.position.z);

            resultPanelView.setResultPosition(newpos);

            menuController.GETMainMenuModel().ChangeVisibility(false);
            view.setVisibility(false);
            resultPanelModel.ChangeResultVisibility(true);

            IMapController mapController = GetComponent <MapController>();

            mapController.GETMapView().setGameObjectVisibility(false);

            IMapMenuController mapMenuController = GetComponent <MapMenuController>();

            mapMenuController.GETMapMenuView().MenuVisibility(false);

            ITemporalController temporalController = GetComponent <TemporalController>();

            temporalController.GETItTemporalView().MenuVisibility(false);
        }
Example #46
0
        public void DrawMap(IMapController controller, object args)
        {
            var batch = args as SpriteBatch;

            DrawMap(batch, controller);
        }
Example #47
0
 public void DrawMap(SpriteBatch spriteBatch, IMapController controller)
 {
     DrawLayer(spriteBatch, controller.GetLayer("GROUND"));
 }
Example #48
0
 public InventUpgrade(IMapController map, int k, int depth)
     : base(map, depth, "Invent upgrade")
 {
     kPoints = k / 1000.0f;
     kUpgrade = 1 - kPoints;
 }
Example #49
0
 public BuildMarket(IMapController map, double kHexa, double kHasSources, double kBestSource, double kHasOtherMarket, double kHasMarket, int depth)
     : base(map, depth, "BuildMarket")
 {
     BaseInit(kHasMarket);
 }
Example #50
0
 public FortStealSourcesAtom(IMapController map, IPlayer player, int depth)
     : base(map, depth, "Steal sources")
 {
     this.player = player;
 }
Example #51
0
 public InventUpgrade(IMapController map, int depth)
     : base(map, depth, "Invent upgrade")
 {
 }
Example #52
0
 public WaitTurnAtom(IMapController map, int turn, int depth)
     : base(map, depth, "Wait turn")
 {
     this.turn = turn;
 }
Example #53
0
 public RaiseSources(IMapController map, List<ISourceAll> sourceList, int depth)
     : base(map, depth, "Raise sources")
 {
     this.source = sourceList;
     Init();
 }
Example #54
0
 public abstract void InstantiationAction(IMapController mapController);
Example #55
0
 public BuildRoadAtom(IMapController map, IRoad road, int depth)
     : base(map, depth, "Build road")
 {
     this.road = road;
 }
Example #56
0
 protected override void DisposeInternal()
 {
     _mapController = null;
     base.DisposeInternal();
 }
Example #57
0
 public RaiseSources(IMapController map, PriceKind priceKind, int depth)
     : this(map, map.GetPrice(priceKind), depth)
 {
 }
Example #58
0
 public Grid(IMapController mapController)
 {
     _mapController = mapController;
 }
Example #59
0
 public FortShowParadeAtom(IMapController map, int depth)
     : base(map, depth, "Show parade")
 {
 }
Example #60
0
 public FortCaptureHexa(IMapController map, int depth)
     : base(map, depth, "Capture hexa")
 {
     bestHexa = null;
     bestHexaIDs = new List<int>();
 }