Beispiel #1
0
    void Awake()
    {
        instance = this;

        terrainMap = TerrainMapController.instance.tilemap;

        Pathfinder.Initialize(terrainMap);

        unitManager      = GetComponent <MapUnitManager>();
        resourceManager  = GetComponent <MapResourceManager>();
        castleManager    = GetComponent <MapCastleManager>();
        cameraController = GetComponent <MapSceneCameraController>();
    }
Beispiel #2
0
    /// <summary>
    /// Handles ResourceManager ResourceInit event
    /// </summary>
    protected void ResourceManager_ResourceInit(object sender, EventArgs e)
    {
        if (DesignMode)
        {
            return;
        }
        ResourceManager manager = sender as ResourceManager;

        if (!manager.FailureOnInitialize)
        {
            return;
        }
        if (manager is MapResourceManager)
        {
            MapResourceManager mapManager = manager as MapResourceManager;
            for (int i = 0; i < mapManager.ResourceItems.Count; i++)
            {
                MapResourceItem item = mapManager.ResourceItems[i];
                if (item != null && item.FailedToInitialize)
                {
                    mapManager.ResourceItems[i] = null;
                }
            }
        }
        else if (manager is GeocodeResourceManager)
        {
            GeocodeResourceManager gcManager = manager as GeocodeResourceManager;
            for (int i = 0; i < gcManager.ResourceItems.Count; i++)
            {
                GeocodeResourceItem item = gcManager.ResourceItems[i];
                if (item != null && item.FailedToInitialize)
                {
                    gcManager.ResourceItems[i] = null;
                }
            }
        }
        else if (manager is GeoprocessingResourceManager)
        {
            GeoprocessingResourceManager gpManager = manager as GeoprocessingResourceManager;
            for (int i = 0; i < gpManager.ResourceItems.Count; i++)
            {
                GeoprocessingResourceItem item = gpManager.ResourceItems[i];
                if (item != null && item.FailedToInitialize)
                {
                    gpManager.ResourceItems[i] = null;
                }
            }
        }
    }
    private void Awake()
    {
        //gameTileClickHandler.OnGameTileClickedEvent += OnGameTileClickedEvent;
        inputManager = GetComponent <MapSceneInputManager>();

        worldMapManager = GetComponent <WorldMapManager>();

        interactableManager = GetComponent <MapInteractableManager>();

        cameraController = GetComponent <MapSceneCameraController>();

        mapResourcesManager = GetComponent <MapResourceManager>();

        animalManager = GetComponent <MapAnimalManager>();
    }
Beispiel #4
0
    public void SetItem(MapResourceObject resourceObject, int amount, int max, Vector3Int pos, MapResourceManager manager)
    {
        this.resourceObject = resourceObject;
        this.amount         = amount;
        this.maxCapacity    = max;
        this.manager        = manager;

        icon.sprite  = resourceObject.image;
        resourceType = resourceObject.resourceType;

        resourceID = resourceObject.id;

        //myShip = GameManager.instance.globalCountryManager.myCountry;

        position = pos;

        manager.resources.Add(this);
    }
Beispiel #5
0
        protected override void OnPreRender(EventArgs e)
        {
            base.OnPreRender(e);

            m_id = this.ClientID;
            // find the map, task results and map resource manager controls
            m_map = Page.FindControl(m_mapBuddyId) as Map;
            m_taskResults = FindControlRecursive(Page, m_taskResultsId) as TaskResults;
            m_resourceManger = m_map.MapResourceManagerInstance;

            #region Register script for creating script object
            ScriptManager sm = ScriptManager.GetCurrent(this.Page);
            if (sm != null) sm.RegisterAsyncPostBackControl(this);
            string create = String.Format("\nSys.Application.add_init(function() {{\n\t$create(ESRI.ADF.UI.MapIdentifyTool,{{\"id\":\"{3}\",\"uniqueID\":\"{0}\",\"callbackFunctionString\":\"{1}\",\"identifyIcon\":\"{4}\",\"waitIcon\":\"{5}\"}},null,{{\"map\":\"{2}\"}});\n\tMapIdentifyTool = function() {{ $find('{3}').startIdentify(); }};\n }});\n",
                this.UniqueID, this.CallbackFunctionString, m_map.ClientID, this.ClientID, m_identifyIconUrl, m_waitIconUrl);
            Page.ClientScript.RegisterStartupScript(this.GetType(), this.Id + "_startup", create, true);
            #endregion
        }
Beispiel #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     m_id = this.ClientID;
     m_page = this.Page;
     // find the map control
     if (m_mapBuddyId == null || m_mapBuddyId.Length == 0) m_mapBuddyId = "Map1";
     m_map = m_page.FindControl(m_mapBuddyId) as Map;
     // find the map resource manager
     m_resourceManger = m_page.FindControl(m_map.MapResourceManager) as MapResourceManager;
     m_callbackInvocation = m_page.ClientScript.GetCallbackEventReference(this, "argument", "processCallbackResult", "context", true);
 }