Beispiel #1
0
    bool addPannel(panel newPanel, panel previousPanel, float moveCost, Queue <panel> searchQueue, Vector2Int dirFromOriginal, int enemyIndex)
    {
        if (newPanel.isValid)
        {
            if (newPanel.visited == false || newPanel.cost > previousPanel.cost + moveCost + newPanel.baseCost)
            {
                newPanel.visited = true;
                if (enemyPrefabs[enemyIndex].GetComponent <EnemyScript>().fly)
                {
                    newPanel.cost = previousPanel.cost + moveCost;
                }
                else
                {
                    newPanel.cost = newPanel.baseCost + previousPanel.cost + moveCost;
                }

                newPanel.addParrent(previousPanel);
                gameBoard[previousPanel.position.x + dirFromOriginal.x, previousPanel.position.y + dirFromOriginal.y] = newPanel;
                setTilemapSearched(newPanel.position, newPanel.cost);
                newPanel.calcTotalCost();

                searchQueue.Enqueue(newPanel);
                return(true);
            }
        }
        return(false);
    }
Beispiel #2
0
        private PictureBox cancelButton(ProgressBar progressbar, panel e)
        {
            int progressbarWidth = progressbar.Width;
            int positionX        = progressbar.Location.X + progressbarWidth + 5;
            int positionY        = progressbar.Location.Y;
            int index            = Int32.Parse(Regex.Match(progressbar.Name, @"\d+").Value);

            PictureBox picturebox = new PictureBox();

            picturebox.Location = new System.Drawing.Point(positionX, positionY);
            picturebox.Width    = 32;
            picturebox.Height   = 32;
            Image cancelbuttonimage = Properties.Resources.cancel;

            picturebox.Image = cancelbuttonimage;
            switch (e)
            {
            case panel.panel1:
                picturebox.Name = "cancelbutton" + index.ToString();
                infopanel.Controls.Add(picturebox);
                break;

            case panel.panel2:
                picturebox.Name = "batchcancelbutton" + index.ToString();
                batchpanel.Controls.Add(picturebox);
                break;
            }

            return(picturebox);
        }
Beispiel #3
0
 // Use this for initialization
 void Start()
 {
     anim                  = GetComponent <Animator>();
     package_panel         = transform.Find("weapons_panel").GetComponent <panel>();
     display               = transform.Find("Image").GetComponent <Image>();
     text_description      = transform.Find("Text_description").GetComponent <Text>();
     text_description.text = "";
     text_name             = transform.Find("Text_weaponsname").GetComponent <Text>();
     text_name.text        = "";
     package_panel.initial_panel();
 }
Beispiel #4
0
 /**
  * Generates references based on children
  */
 override public void Start()
 {
     if (buildingPanel == null)
     {
         DontDestroyOnLoad(gameObject);
         buildingPanel = this;
     }
     else if (buildingPanel != this)
     {
         Destroy(gameObject);
     }
     activePanel = panel.DECORATIVE;
     SwitchPanels();
 }
Beispiel #5
0
    /**
     * A function for switching between the panels
     */
    public void SwitchPanels()
    {
        // Turn off current panel
        this.transform.GetChild((int)activePanel).gameObject.SetActive(false);

        // Set activePanel
        if (activePanel == panel.RESOURCE)
        {
            activePanel = panel.DECORATIVE;
        }
        else
        {
            activePanel = panel.RESOURCE;
        }

        // Turn on current panel
        this.transform.GetChild((int)activePanel).gameObject.SetActive(true);
    }
Beispiel #6
0
    // Use this for initialization
    void Start()
    {
        Enemys     = new List <GameObject>();
        pathPoints = new List <List <Vector3Int> >();
        gameBoard  = new panel[30, 30];
        startPos   = new Vector3Int((int)startPoint.transform.position.x, (int)startPoint.transform.position.y, 0);
        targetPoint.transform.position = Vector3Int.FloorToInt(targetPoint.transform.position);
        Vector3Int point = Vector3Int.FloorToInt(targetPoint.transform.position);


        for (int i = 0; i < 30; i++)
        {
            for (int j = 0; j < 30; j++)
            {
                float cost = Random.Range(0, 0);
                gameBoard[i, j] = new panel(new Vector2Int(i, j), cost);

                if (wallMap.GetTile(new Vector3Int(i - 15, j - 15, 0)) != null)
                {
                    gameBoard[i, j].isValid = false;
                }
                else
                {
                    gameBoard[i, j].distFromGoal = distFromGoal(new Vector3Int(i, j, 0), point + new Vector3Int(15, 15, 0));
                    if (terrainMap.GetTile(new Vector3Int(i - 15, j - 15, 0)) != null)
                    {
                        if (terrainMap.GetTile(new Vector3Int(i - 15, j - 15, 0)).name == "TerrainSlow")
                        {
                            gameBoard[i, j].baseCost = .5f;
                        }
                        else if (terrainMap.GetTile(new Vector3Int(i - 15, j - 15, 0)).name == "TerrainFast")
                        {
                            gameBoard[i, j].baseCost = -.5f;
                        }
                    }
                }
            }
        }

        //startRound(0);
    }
Beispiel #7
0
        private void setPanelVisibility(panel currentPanel)
        {
            if (JustStarted)
            {
                mainBox.Visible = true;
                LoadComponentsMenu();
                JustStarted = false;
            }

            foreach (Control ctrl in mainPanel.Controls)
            {
                ctrl.Dispose();
            }

            switch (currentPanel)
            {
            case panel.maintenanceWork:
            {
                maintenanceWorkUserControl.Dock = DockStyle.Fill;
                mainPanel.Controls.Add(maintenanceWorkUserControl);
                break;
            }

            case panel.regularMaintenance:
            {
                regularMaintenanceUserControl.Dock = DockStyle.Fill;
                mainPanel.Controls.Add(regularMaintenanceUserControl);
                break;
            }

            case panel.workingHours:
            {
                workingHrsUserControl.Dock = DockStyle.Fill;
                mainPanel.Controls.Add(workingHrsUserControl);
                break;
            }
            }
            CurrentPanel = currentPanel;
        }
Beispiel #8
0
        //dynamically create new progressbar
        private ProgressBar CreateProgressbar(int index, panel e)
        {
            ProgressBar progressbar = new ProgressBar();

            progressbar.Width  = 150;
            progressbar.Height = 32;
            switch (e)
            {
            case panel.panel1:
                progressbar.Location = new System.Drawing.Point(700, 32 * index + infopanel.AutoScrollPosition.Y);
                progressbar.Name     = "progressBar" + index.ToString();
                infopanel.Controls.Add(progressbar);     // add controls to a selected tabpage
                break;

            case panel.panel2:
                progressbar.Location = new System.Drawing.Point(660, 32 * index + batchpanel.AutoScrollPosition.Y);
                progressbar.Name     = "batchprogressbar" + index.ToString();
                batchpanel.Controls.Add(progressbar);
                break;
            }

            return(progressbar);
        }
Beispiel #9
0
        private TextBox createInfobox(infotype e, int index, panel tab)
        {
            TextBox infobox = new TextBox();

            infobox.BackColor   = Color.White;
            infobox.BorderStyle = BorderStyle.None;
            infobox.ReadOnly    = true;
            infobox.Height      = 32;
            switch (e)
            {
            case infotype.Episode:
            {
                infobox.Location = new System.Drawing.Point(5, 11 + 32 * index + infopanel.AutoScrollPosition.Y);
                infobox.Name     = "episode" + index.ToString();
                infobox.Width    = 400;
                break;
            }

            case infotype.Date:
            {
                infobox.Location = new System.Drawing.Point(450, 11 + 32 * index + infopanel.AutoScrollPosition.Y);
                infobox.Name     = "date" + index.ToString();
                infobox.Width    = 200;
                break;
            }
            }
            if (tab == panel.panel1)
            {
                infopanel.Controls.Add(infobox);
            }
            else
            {
                batchpanel.Controls.Add(infobox);
            }
            return(infobox);
        }
Beispiel #10
0
	public LinkInventory(PlayerControl pc,panel panel)
	{
		this.pc = pc;
		this.panel = panel;
	}
Beispiel #11
0
 public void addParrent(panel par)
 {
     parentDir = par.position - position;
 }
Beispiel #12
0
    void getDirectionsToPoint(Vector2Int point, int index)
    {
        List <panel>  priorityQueue = new List <panel>();
        Queue <panel> searchQueue   = new Queue <panel>();


        Vector2Int panelPos = new Vector2Int(startPos.x + 15, startPos.y + 15);

        point.x += 15;
        point.y += 15;

        panel finalPoint = gameBoard[point.x, point.y];

        gameBoard[panelPos.x, panelPos.y].visited = true;

        searchQueue.Enqueue(gameBoard[panelPos.x, panelPos.y]);

        int count = 1;

        while (searchQueue.Count > 0)
        {
            panel tempPanel = searchQueue.Dequeue();

            setTilemapSearched(tempPanel.position, tempPanel.cost);

            if (enemyPrefabs[index].GetComponent <EnemyScript>().hop)
            {
                int movecost = 2;
                if (tempPanel.position.x > 1)
                {
                    panel westPanel = gameBoard[tempPanel.position.x - 2, tempPanel.position.y];
                    if (addPannel(westPanel, tempPanel, movecost, searchQueue, new Vector2Int(-2, 0), index))
                    {
                        if (westPanel.position == finalPoint.position)
                        {
                            break;
                        }
                    }
                }

                if (tempPanel.position.x < 28)
                {
                    panel eastPanel = gameBoard[tempPanel.position.x + 2, tempPanel.position.y];
                    if (addPannel(eastPanel, tempPanel, movecost, searchQueue, new Vector2Int(2, 0), index))
                    {
                        if (eastPanel.position == finalPoint.position)
                        {
                            break;
                        }
                    }
                }
                if (tempPanel.position.y > 1)
                {
                    panel southPanel = gameBoard[tempPanel.position.x, tempPanel.position.y - 2];
                    if (addPannel(southPanel, tempPanel, movecost, searchQueue, new Vector2Int(0, -2), index))
                    {
                        if (southPanel.position == finalPoint.position)
                        {
                            break;
                        }
                    }
                }
                if (tempPanel.position.y < 28)
                {
                    panel northPanel = gameBoard[tempPanel.position.x, tempPanel.position.y + 2];

                    if (addPannel(northPanel, tempPanel, movecost, searchQueue, new Vector2Int(0, 2), index))
                    {
                        if (northPanel.position == finalPoint.position)
                        {
                            break;
                        }
                    }
                }
            }
            if (tempPanel.position.x > 0)
            {
                panel westPanel = gameBoard[tempPanel.position.x - 1, tempPanel.position.y];

                if (addPannel(westPanel, tempPanel, 1, searchQueue, new Vector2Int(-1, 0), index))
                {
                    if (westPanel.position == finalPoint.position)
                    {
                        break;
                    }
                }
            }


            if (tempPanel.position.x < 29)
            {
                panel eastPanel = gameBoard[tempPanel.position.x + 1, tempPanel.position.y];

                if (addPannel(eastPanel, tempPanel, 1, searchQueue, new Vector2Int(1, 0), index))
                {
                    if (eastPanel.position == finalPoint.position)
                    {
                        break;
                    }
                }
            }
            if (tempPanel.position.y > 0)
            {
                panel southPanel = gameBoard[tempPanel.position.x, tempPanel.position.y - 1];

                if (addPannel(southPanel, tempPanel, 1, searchQueue, new Vector2Int(0, -1), index))
                {
                    if (southPanel.position == finalPoint.position)
                    {
                        break;
                    }
                }
            }
            if (tempPanel.position.y < 29)
            {
                panel northPanel = gameBoard[tempPanel.position.x, tempPanel.position.y + 1];

                if (addPannel(northPanel, tempPanel, 1, searchQueue, new Vector2Int(0, 1), index))
                {
                    if (northPanel.position == finalPoint.position)
                    {
                        break;
                    }
                }
            }

            if (enemyPrefabs[index].GetComponent <EnemyScript>().diagonalMove)
            {
                if (tempPanel.position.x > 0 && tempPanel.position.y > 0)
                {
                    panel southWest = gameBoard[tempPanel.position.x - 1, tempPanel.position.y - 1];

                    if (validDiagonalMove(tempPanel.position, new Vector2Int(-1, -1)))
                    {
                        if (addPannel(southWest, tempPanel, 1.414f, searchQueue, new Vector2Int(-1, -1), index))
                        {
                            if (southWest.position == finalPoint.position)
                            {
                                break;
                            }
                        }
                    }
                }
                if (tempPanel.position.x > 0 && tempPanel.position.y < 29)
                {
                    panel northWest = gameBoard[tempPanel.position.x - 1, tempPanel.position.y + 1];

                    if (validDiagonalMove(tempPanel.position, new Vector2Int(-1, 1)))
                    {
                        if (addPannel(northWest, tempPanel, 1.414f, searchQueue, new Vector2Int(-1, 1), index))
                        {
                            if (northWest.position == finalPoint.position)
                            {
                                break;
                            }
                        }
                    }
                }

                if (tempPanel.position.x < 29 && tempPanel.position.y > 0)
                {
                    panel southEast = gameBoard[tempPanel.position.x + 1, tempPanel.position.y - 1];


                    if (validDiagonalMove(tempPanel.position, new Vector2Int(1, -1)))
                    {
                        if (addPannel(southEast, tempPanel, 1.414f, searchQueue, new Vector2Int(1, -1), index))
                        {
                            if (southEast.position == finalPoint.position)
                            {
                                break;
                            }
                        }
                    }
                }

                if (tempPanel.position.x < 29 && tempPanel.position.y < 29)
                {
                    panel northEast = gameBoard[tempPanel.position.x + 1, tempPanel.position.y + 1];


                    if (validDiagonalMove(tempPanel.position, new Vector2Int(1, 1)))
                    {
                        if (addPannel(northEast, tempPanel, 1.414f, searchQueue, new Vector2Int(1, 1), index))
                        {
                            if (northEast.position == finalPoint.position)
                            {
                                break;
                            }
                        }
                    }
                }
            }



            priorityQueue = searchQueue.ToList <panel>();

            priorityQueue.Sort((x, y) => x.totalCost.CompareTo(y.totalCost));
            count += 8;

            searchQueue = new Queue <panel>(priorityQueue);
        }



        searchQueue.Clear();

        panel currentPoint = gameBoard[point.x, point.y];
        int   totalSteps   = 0;
        Color col          = Random.ColorHSV();

        pathPoints[index].Insert(0, currentPoint.getWorldPosition());

        while (currentPoint.position != panelPos)
        {
            panel parrent = gameBoard[currentPoint.position.x + currentPoint.parentDir.x, currentPoint.position.y + currentPoint.parentDir.y];

            Debug.DrawLine(currentPoint.getWorldPosition(), parrent.getWorldPosition(), col, 100000);

            currentPoint = parrent;
            pathPoints[index].Insert(0, parrent.getWorldPosition());
            totalSteps++;
            if (totalSteps > 150)
            {
                break;
            }
        }

        //pathPoints.Insert(0, currentPoint.getWorldPosition());
    }
Beispiel #13
0
    /**
     * A function for switching between the panels
     */
    public void SwitchPanels()
    {
        // Turn off current panel
        this.transform.GetChild((int)activePanel).gameObject.SetActive(false);

        // Set activePanel
        if (activePanel == panel.RESOURCE)
        {
            activePanel = panel.DECORATIVE;
        }
        else
        {
            activePanel = panel.RESOURCE;
        }

        // Turn on current panel
        this.transform.GetChild((int)activePanel).gameObject.SetActive(true);
    }
Beispiel #14
0
        public PanelDetay Goster()
        {
            FaturaIslemleri fat = new FaturaIslemleri(dc);

            int yakOdeme = fat.yaklasanOdemeSayisi(DateTime.Now.AddDays(3));

            decimal   kasaBakiye  = 0;
            decimal   bankaBakiye = 0;
            decimal   posBakiye   = 0;
            kasahesap h           = dc.kasahesaps.FirstOrDefault();

            if (h != null)
            {
                kasaBakiye = h.ToplamBakiye;
            }
            List <banka> b = dc.bankas.ToList();

            if (b.Count > 0)
            {
                bankaBakiye = b.Sum(x => x.bakiye);
            }

            List <poshesap> po = dc.poshesaps.Where(x => x.iptal == false && x.cekildi == false).ToList();

            if (po.Count > 0)
            {
                posBakiye = po.Sum(x => x.net_tutar);
            }

            panel   p            = dc.panels.FirstOrDefault();
            int     onayBekleyen = 0;
            int     servisSayi   = 0;
            int     emanetSayi   = 0;
            int     musteriSayi  = 0;
            decimal netBorc      = 0;
            decimal netAlacak    = 0;
            decimal netBakiye    = 0;

            if (p != null)
            {
                onayBekleyen = p.onay_bekleyen_sayisi;
                servisSayi   = p.servis_sayisi;
                emanetSayi   = p.emanet_sayisi;
                musteriSayi  = p.musteri_sayisi;
                netBorc      = p.NetBorc;
                netAlacak    = p.NetAlacak;
                netBakiye    = p.ToplamBakiye;
            }
            PanelDetay pan = new PanelDetay();

            pan.bankaBakiye   = bankaBakiye;
            pan.emanetSayisi  = emanetSayi;
            pan.kasaBakiye    = kasaBakiye;
            pan.musteriSayisi = musteriSayi;
            pan.netAlacak     = netAlacak;
            pan.netBakiye     = netBakiye;
            pan.netBorc       = netBorc;
            pan.onayBekleyen  = onayBekleyen;
            pan.posBakiye     = posBakiye;
            pan.servisSayisi  = servisSayi;

            pan.yaklasanOdeme = yakOdeme;
            return(pan);
        }
Beispiel #15
0
 public LinkInventory(PlayerControl pc, panel panel)
 {
     this.pc    = pc;
     this.panel = panel;
 }
Beispiel #16
0
        private TextBox createInfobox(infotype e,int index,panel tab)
        {
            TextBox infobox =new TextBox();
            infobox.BackColor = Color.White;
            infobox.BorderStyle = BorderStyle.None;
            infobox.ReadOnly = true;
            infobox.Height = 32;
            switch(e)
            {
                case infotype.Episode:
                    {
                        infobox.Location = new System.Drawing.Point(5, 11+32 * index+infopanel.AutoScrollPosition.Y);
                        infobox.Name = "episode"+index.ToString();
                        infobox.Width = 400;
                        break;
                    }
                case infotype.Date:
                    {
                        infobox.Location = new System.Drawing.Point(450, 11+32*index+infopanel.AutoScrollPosition.Y);
                        infobox.Name = "date"+index.ToString();
                        infobox.Width = 200;
                        break;
                    }

            }
            if(tab == panel.panel1)
            {
                infopanel.Controls.Add(infobox);
            }
            else
            {
                batchpanel.Controls.Add(infobox);
            }
            return infobox;

        }
Beispiel #17
0
 private  PictureBox cancelButton(ProgressBar progressbar,panel e)
 {
     int progressbarWidth = progressbar.Width;
     int positionX = progressbar.Location.X + progressbarWidth + 5;
     int positionY = progressbar.Location.Y;
     int index = Int32.Parse(Regex.Match(progressbar.Name, @"\d+").Value);
     
     PictureBox picturebox = new PictureBox();
     picturebox.Location = new System.Drawing.Point(positionX, positionY);
     picturebox.Width = 32;
     picturebox.Height = 32;
     Image cancelbuttonimage = Properties.Resources.cancel;
     picturebox.Image = cancelbuttonimage;
     switch(e)
     {
         case panel.panel1:
             picturebox.Name = "cancelbutton" + index.ToString();
             infopanel.Controls.Add(picturebox);
             break;
         case panel.panel2:
             picturebox.Name = "batchcancelbutton" + index.ToString();
             batchpanel.Controls.Add(picturebox);
             break;
     }
     
     return picturebox;
 }
Beispiel #18
0
 //dynamically create new progressbar
 private ProgressBar CreateProgressbar(int index,panel e)
 {
     ProgressBar progressbar = new ProgressBar();
     progressbar.Width = 150;
     progressbar.Height = 32;
     switch(e)
     {
         case panel.panel1:
             progressbar.Location = new System.Drawing.Point(700, 32 * index + infopanel.AutoScrollPosition.Y);
             progressbar.Name = "progressBar" + index.ToString();
             infopanel.Controls.Add(progressbar); // add controls to a selected tabpage
             break;
         case panel.panel2:
             progressbar.Location = new System.Drawing.Point(660, 32 * index + batchpanel.AutoScrollPosition.Y);
             progressbar.Name = "batchprogressbar" + index.ToString();
             batchpanel.Controls.Add(progressbar);
             break;
     }
     
     return progressbar;
 }
Beispiel #19
0
        private void ComboBoxes(panel pnl)
        {
            this.stslbl1.Text = "Carregando...";
            CbList dbCtrl = new CbList();

            if (pnl == panel.Insert)
            {
                this.comboBoxUF.DataSource = dbCtrl.listUf();
                this.comboBoxUF.DisplayMember = "Uf";
                this.comboBoxUF.Text = "SP";
                this.comboBoxCity.DataSource = dbCtrl.listCity(this.comboBoxUF.Text);
                this.comboBoxCity.DisplayMember = "Nome";
                this.comboBoxCity.Text = "São José dos Campos";
            }
            else if (pnl == panel.Update)
            {
                this.comboBoxEUF.DataSource = dbCtrl.listUf();
                this.comboBoxEUF.DisplayMember = "Uf";
                this.comboBoxECity.DataSource = dbCtrl.listCity(this.comboBoxUF.Text);
                this.comboBoxECity.DisplayMember = "Nome";
            }
            this.stslbl1.Text = "Carregado";
        }
Beispiel #20
0
 // Use this for initialization
 void Start()
 {
     panel_instance = this;
 }
Beispiel #21
0
 private void PanelShow(panel Name)
 {
     AllHide();
     if (Name == panel.FileUpload)
     {
         pnlFileUpload.Visible = true;
     }
     if (Name == panel.HeaderControl)
     {
         pnlHeaderControl.Visible = true;
     }
     if (Name == panel.BarControl)
     {
         pnlBarControl.Visible = true;
     }
     if (Name == panel.Layout)
     {
         pnlLayout.Visible = true;
     }
     if (Name == panel.Widget)
     {
         pnlWidget.Visible = true;
     }
     if (Name == panel.DataTable)
     {
         pnlDataTable.Visible = true;
     }
     if (Name == panel.Dashboard)
     {
         pnlDashboard.Visible = true;
     }
     if (Name == panel.Chart)
     {
         pnlChart.Visible = true;
     }
     if (Name == panel.Icon)
     {
         pnlIcon.Visible = true;
     }
     if (Name == panel.Button)
     {
         pnlButton.Visible = true;
     }
     if (Name == panel.Lablel)
     {
         pnlLablel.Visible = true;
     }
     if (Name == panel.Droupdown)
     {
         pnlDroupdown.Visible = true;
     }
     if (Name == panel.RadioButton)
     {
         pnlRadioButton.Visible = true;
     }
     if (Name == panel.LinkButton)
     {
         pnlLinkButton.Visible = true;
     }
     if (Name == panel.CheckBox)
     {
         pnlCheckBox.Visible = true;
     }
     if (Name == panel.Uploader)
     {
         pnlUploader.Visible = true;
     }
     if (Name == panel.Image)
     {
         pnlImage.Visible = true;
     }
     if (Name == panel.Alert)
     {
         pnlAlert.Visible = true;
     }
     if (Name == panel.Process)
     {
         pnlProcess.Visible = true;
     }
     if (Name == panel.DempPage)
     {
         pnlDempPage.Visible = true;
     }
     if (Name == panel.LoginPage)
     {
         pnlLoginPage.Visible = true;
     }
     if (Name == panel.Invoice)
     {
         pnlInvoice.Visible = true;
     }
     if (Name == panel.Reporting)
     {
         pnlReporting.Visible = true;
     }
 }
Beispiel #22
0
 /**
  * Generates references based on children
  */
 public override void Start()
 {
     if (buildingPanel == null) {
         DontDestroyOnLoad(gameObject);
         buildingPanel = this;
     }
     else if (buildingPanel != this) {
         Destroy(gameObject);
     }
     activePanel = panel.DECORATIVE;
     SwitchPanels();
 }