Exemplo n.º 1
0
        public BuildingController()
        {
            Service.Set <BuildingController>(this);
            this.buildingSelector       = new BuildingSelector();
            this.buildingMover          = new BuildingMover(this.buildingSelector);
            this.entityShaderSwapper    = new EntityShaderSwapper();
            this.purchasingBuilding     = false;
            this.purchasingStampable    = 0;
            this.purchasingBuildingType = null;
            this.UnstashStampingEnabled = false;
            this.stampingCellsX         = new int[2];
            this.stampingCellsZ         = new int[2];
            this.ResetStampLocations();
            this.edgeRotations = new int[4, 2, 2];
            int num  = 1;
            int num2 = 0;

            for (int i = 0; i < 4; i++)
            {
                this.edgeRotations[i, 0, 0] = num;
                this.edgeRotations[i, 0, 1] = -num2;
                this.edgeRotations[i, 1, 0] = num2;
                this.edgeRotations[i, 1, 1] = num;
                int num3 = num;
                num  = -num2;
                num2 = num3;
            }
            EventManager eventManager = Service.Get <EventManager>();

            eventManager.RegisterObserver(this, EventId.BuildingLevelUpgraded, EventPriority.Default);
            eventManager.RegisterObserver(this, EventId.BuildingSwapped, EventPriority.Default);
            eventManager.RegisterObserver(this, EventId.ClearableCleared, EventPriority.Default);
            eventManager.RegisterObserver(this, EventId.ContractCompletedForStoryAction, EventPriority.Default);
            eventManager.RegisterObserver(this, EventId.ContractCompleted, EventPriority.Default);
        }
Exemplo n.º 2
0
 public TestForm()
 {
     InitializeComponent();
     log                = new LogToText(this.txtLog, this);
     touch              = new Touch(log);
     buildingSelector   = new BuildingSelector(log, touch);
     captureScreen      = new CaptureScreen(log);
     tradeWindow        = new TradeWindow(captureScreen, log);
     navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
     resourceReader     = new CommerceResourceReader(log, touch);
     buildItemList      = CommerceItemBuild.CreateResourceList();
 }
Exemplo n.º 3
0
        public BuyForm()
        {
            InitializeComponent();

            log = new NoOpLogger();


            touch              = new Touch(log);
            captureScreen      = new CaptureScreen(new NoOpLogger(), touch);
            resourceReader     = new CommerceResourceReader(log, touch);
            buildingSelector   = new BuildingSelector(log, touch);
            tradeWindow        = new TradeWindow(captureScreen, log);
            tradePanelCapture  = new TradePanelCapture(tradeWindow);
            navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
            buildItemList      = CommerceItemBuild.CreateResourceList();

            tradeWindow.PictureBox = this.pictureBox1;

            var pictureBoxes = new List <PictureBox>();
            var textBoxes    = new List <TextBox>();

            pictureBoxes.Add(this.pb1);
            pictureBoxes.Add(this.pb2);
            pictureBoxes.Add(this.pb3);
            pictureBoxes.Add(this.pb4);
            pictureBoxes.Add(this.pb5);
            pictureBoxes.Add(this.pb6);
            pictureBoxes.Add(this.pb7);
            pictureBoxes.Add(this.pb8);

            textBoxes.Add(this.tb1);
            textBoxes.Add(this.tb2);
            textBoxes.Add(this.tb3);
            textBoxes.Add(this.tb4);
            textBoxes.Add(this.tb5);
            textBoxes.Add(this.tb6);
            textBoxes.Add(this.tb7);
            textBoxes.Add(this.tb8);

            itemHashes = new ItemHashes(pictureBoxes, textBoxes);

            LoadShoppingLists();

            salesman  = new Salesman(touch, tradeWindow, tradePanelCapture, itemHashes, navigateToBuilding, log);
            craftsman = new Craftsman(log, buildingSelector, navigateToBuilding, touch, resourceReader, buildItemList);
        }
    // Use this for initialization
    void Start()
    {
        var resources = transform.Find("Resources");

        goldText = resources.transform.Find("txtGold").gameObject.GetComponent <Text>();
        grid     = Instantiate(gridPrefab);
        var gridScript = grid.GetComponent <Grid>();

        gridScript.SetCamera(playerCamera);
        grid.SetActive(false);
        GetBuildingPlacement();
        UpdateGoldAmount();

        var buildMenu      = transform.Find("BuildMenu");
        var toolTip        = buildMenu.transform.Find("ToolTip");
        var buildMenuPanel = buildMenu.Find("Panel");

        foreach (var building in buildings)
        {
            var newBtn = Instantiate(buildingBtnPrefab);
            newBtn.GetComponent <Image>().sprite = building.GetComponent <SpriteRenderer>().sprite;
            var newBtnToolTipScript = newBtn.GetComponent <BtnToolTip>();
            var buildingScript      = building.GetComponent <Building>();
            newBtnToolTipScript.SetTooltip(toolTip.gameObject);
            newBtnToolTipScript.title = buildingScript.name;
            newBtnToolTipScript.costs = buildingScript.costs.ToString();
            newBtnToolTipScript.life  = buildingScript.life.ToString();
            if (buildingScript is TowerController)
            {
                var towerScript = (TowerController)buildingScript;
                newBtnToolTipScript.dmg   = towerScript.bulletPrefab.GetComponent <BulletController>().dmg.ToString();
                newBtnToolTipScript.range = towerScript.range.ToString();
            }

            buildingBtnList.Add(newBtn);
            newBtn.transform.Find("Text").GetComponent <Text>().text = buildingBtnList.Count.ToString();
            newBtn.transform.SetParent(buildMenuPanel);
            newBtn.transform.localScale = new Vector3(1, 1, 1);
        }

        buildingSelector = new BuildingSelector(buildings.Select(x => x.GetComponent <buildings>()));
    }
Exemplo n.º 5
0
        public BotForm()
        {
            InitializeComponent();
            log              = new LogToText(this.txtLog, this);
            touch            = new Touch(log);
            buildingSelector = new BuildingSelector(log, touch);

            captureScreen = new CaptureScreen(log);
            tradeWindow   = new TradeWindow(captureScreen, log);

            navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);
            resourceReader     = new CommerceResourceReader(log, touch);
            buildItemList      = CommerceItemBuild.CreateResourceList();
            tradePanelCapture  = new TradePanelCapture(tradeWindow);

            itemHashes = new ItemHashes(new List <PictureBox>(), new List <TextBox>());
            itemHashes.ReadHashes();
            salesman = new Salesman(touch, tradeWindow, tradePanelCapture, itemHashes, navigateToBuilding, log);

            craftsman = new Craftsman(log, buildingSelector, navigateToBuilding, touch, resourceReader, buildItemList);
        }
Exemplo n.º 6
0
        public TradeDepot()
        {
            InitializeComponent();
            var log = new LogToText(this.txtLog, this);

            captureScreen      = new CaptureScreen(log);
            touch              = new Touch(log);
            tradeWindow        = new TradeWindow(captureScreen, log);
            tradePanelCapture  = new TradePanelCapture(tradeWindow);
            buildingSelector   = new BuildingSelector(log, touch);
            navigateToBuilding = new NavigateToBuilding(log, touch, buildingSelector, tradeWindow);

            tradeWindow.PictureBox = this.pictureBox1;

            var pictureBoxes = new List <PictureBox>();
            var textBoxes    = new List <TextBox>();

            pictureBoxes.Add(this.pb1);
            pictureBoxes.Add(this.pb2);
            pictureBoxes.Add(this.pb3);
            pictureBoxes.Add(this.pb4);
            pictureBoxes.Add(this.pb5);
            pictureBoxes.Add(this.pb6);
            pictureBoxes.Add(this.pb7);
            pictureBoxes.Add(this.pb8);

            textBoxes.Add(this.tb1);
            textBoxes.Add(this.tb2);
            textBoxes.Add(this.tb3);
            textBoxes.Add(this.tb4);
            textBoxes.Add(this.tb5);
            textBoxes.Add(this.tb6);
            textBoxes.Add(this.tb7);
            textBoxes.Add(this.tb8);

            itemHashes = new ItemHashes(pictureBoxes, textBoxes);
            itemHashes.ReadHashes();
            salesman = new Salesman(touch, tradeWindow, tradePanelCapture, itemHashes, navigateToBuilding, log);
        }
Exemplo n.º 7
0
 private void Select(BuildingContainer building)
 {
     BuildingSelector.SetBuilding(building);
 }