void Start()
    {
        switch (Id)
        {
        case ConstructId.Barrack:
            Price = offset.Barrack;
            break;

        case ConstructId.Yard:
            Price = offset.Yard;
            break;

        case ConstructId.Refinery:
            Price = offset.Refinery;
            break;

        case ConstructId.Defender:
            Price = offset.Defender;
            break;
        }
        ClickEvent = Mouse.GetComponent <BuildControl>();

        CurrentImage = GetComponent <Image>();


        CurrentImage.sprite = NewImage;
        newcolo             = CountDownIMG.color;
        newcolo.a           = 0;
        CountDownIMG.color  = newcolo;
    }
        private void DisplayBuild(Build build)
        {
            currentBuild = build != null ? new BuildControl(build, logFilePath) : null;
            SetContent(currentBuild);

            GC.Collect();
        }
Пример #3
0
    /// <summary>
    /// 在鼠标位置初始化未建造的建筑
    /// </summary>
    /// <param name="placeablePrefab"></param>
    public void SetPlaceable(BuildingSO placeablePrefab)
    {
        Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        mousePosition.z = 0;
        //place = placeablePrefab.GetComponent<PlaceControl>();
        placeable = Instantiate(placeablePrefab.buildingPrefab, mousePosition, Quaternion.identity);
        placeable.AddComponent <Rigidbody2D>();
        BoxCollider2D boxCollider2D = placeable.AddComponent <BoxCollider2D>();

        boxCollider2D.isTrigger = true;
        boxCollider2D.size      = new Vector2(boxCollider2D.size.x - boxCollider2D.size.x / 20, boxCollider2D.size.y - boxCollider2D.size.y / 20);

        place = placeable.AddComponent <PlaceControl>();
        BuildControl build = placeable.GetComponent <BuildControl>();

        placeable.name          = placeablePrefab.objectName;
        build.sprite            = placeablePrefab.lowSource;
        build.name              = placeablePrefab.objectName;
        build.durable           = placeablePrefab.durable;
        build.buildProgress     = buildProgress;
        build.dismantleProgress = dismantleProgress;
        build.dTime             = placeablePrefab.dTime;
        build.buildTime         = placeablePrefab.buildTime;
        build.type              = placeablePrefab.type;
        build.cost              = placeablePrefab.cost;
        build.colType           = placeablePrefab.res;
        build.colNum            = placeablePrefab.collectNum;
        build.capacity          = placeablePrefab.capacity;
        placeable.layer         = 11;
        // prefabToPlace = placeablePrefab;
    }
Пример #4
0
    /// <summary>
    /// 在地图上设置建造完的建筑
    /// </summary>
    /// <param name="placeablePrefab"></param>
    public void SetPlaceable(Vector3 initPosition, BuildingSO placeablePrefab)
    {
        //place = placeablePrefab.GetComponent<PlaceControl>();
        GameObject place = Instantiate(placeablePrefab.buildingPrefab, initPosition, Quaternion.identity);

        placeable.AddComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Static;
        BoxCollider2D boxCollider2D = placeable.GetComponent <BoxCollider2D>();

        //  boxCollider2D.isTrigger = true;
        boxCollider2D.size = new Vector2(boxCollider2D.size.x - boxCollider2D.size.x / 20, boxCollider2D.size.y - boxCollider2D.size.y / 20);
        BuildControl build = placeable.GetComponent <BuildControl>();

        placeable.name          = placeablePrefab.objectName;
        build.name              = placeablePrefab.objectName;
        build.durable           = placeablePrefab.durable;
        build.buildProgress     = buildProgress;
        build.dismantleProgress = dismantleProgress;
        build.dTime             = placeablePrefab.dTime;
        build.buildTime         = 0;
        build.type              = placeablePrefab.type;
        build.cost              = new Dictionary <string, int>();
        build.capacity          = placeablePrefab.capacity;
        build.Build();
        placeable.layer = 11;
        // prefabToPlace = placeablePrefab;
    }
Пример #5
0
        private void SetContent(object content)
        {
            // We save build control to allow to bring back states to new one
            if (mainContent.Content is BuildControl current)
            {
                secondToLastBuild = current;
            }

            mainContent.Content = content;

            if (content == null)
            {
                logFilePath     = null;
                projectFilePath = null;
                currentBuild    = null;
            }

            if (content is BuildControl)
            {
                ReloadMenu.Visibility = logFilePath != null ? Visibility.Visible : Visibility.Collapsed;
                SaveAsMenu.Visibility = Visibility.Visible;
            }
            else
            {
                ReloadMenu.Visibility = Visibility.Collapsed;
                SaveAsMenu.Visibility = Visibility.Collapsed;
            }

            // If we had text inside search log control bring it back
            if (mainContent.Content != null && secondToLastBuild != null && mainContent.Content is BuildControl currentContent && currentContent != secondToLastBuild && !string.IsNullOrEmpty(secondToLastBuild.searchLogControl.SearchText))
            {
                currentContent.searchLogControl.searchTextBox.SelectedText = secondToLastBuild.searchLogControl.SearchText;
            }
        }
 public PreprocessedFileManager(BuildControl buildControl, SourceFileResolver sourceFileResolver)
 {
     this.build              = buildControl.Build;
     this.buildControl       = buildControl;
     this.sourceFileResolver = sourceFileResolver;
     BuildImportMap();
 }
Пример #7
0
        protected void grdSalesPrice_DataBound(object sender, EventArgs e)
        {
            //Khu vực
            DropDownList drpStoreGroup = grdSalesPrice.FooterRow.FindControl("drpStoreGroup") as DropDownList;

            if (drpStoreGroup != null)
            {
                BuildControl.BuildDropDownList(LangInt, drpStoreGroup, UtilityLocal.List.Province, false, string.Empty, string.Empty);
            }

            //Loại giá
            DropDownList drpSalesPriceType = grdSalesPrice.FooterRow.FindControl("drpSalesPriceType") as DropDownList;

            if (drpSalesPriceType != null)
            {
                BuildControl.BuildDropDownList(LangInt, drpSalesPriceType, UtilityLocal.List.SalesPriceType, false, string.Empty, string.Empty);
            }

            //Đơn vị
            DropDownList drpUnit = grdSalesPrice.FooterRow.FindControl("drpUnit") as DropDownList;

            if (drpUnit != null)
            {
                BuildControl.BuildDropDownList(LangInt, drpUnit, UtilityLocal.List.UnitMeasure, false, string.Empty, string.Empty);
            }

            //Label lbUnitPrice = (Label)grdSalesPrice.FooterRow.FindControl("lbUnitPrice");
            //lbUnitPrice.Text = FormatHelper.FormatDonviTinh(DBConvert.ParseDouble(lbUnitPrice.Text), enuCostId.dong, Ci);

            //TextBox txtStartingDate = grdSalesPrice.FooterRow.FindControl("txtStartingDate") as TextBox;
            //TextBox txtEndingDate = grdSalesPrice.FooterRow.FindControl("txtEndingDate") as TextBox;
            //txtStartingDate.Text = txtEndingDate.Text = DateTime.Now.ToString();
        }
Пример #8
0
        protected void grdSalesPrice_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                if ((e.Row.RowState & DataControlRowState.Edit) > 0)
                {
                    //Khu vực
                    DropDownList drpStoreGroup = (DropDownList)e.Row.FindControl("drpStoreGroup");
                    if (drpStoreGroup != null)
                    {
                        BuildControl.BuildDropDownList(LangInt, drpStoreGroup, UtilityLocal.List.Province, false, string.Empty, string.Empty);

                        //Set old value selected
                        Label lbStoreGroup = (Label)e.Row.FindControl("lbStoreGroup");
                        drpStoreGroup.SelectedValue = lbStoreGroup.Text;
                    }

                    //Loại giá
                    DropDownList drpSalesPriceType = (DropDownList)e.Row.FindControl("drpSalesPriceType");
                    if (drpSalesPriceType != null)
                    {
                        BuildControl.BuildDropDownList(LangInt, drpSalesPriceType, UtilityLocal.List.SalesPriceType, false, string.Empty, string.Empty);

                        //Set old value selected
                        Label lbSalesPriceType = (Label)e.Row.FindControl("lbSalesPriceType");
                        drpSalesPriceType.SelectedValue = lbSalesPriceType.Text;
                    }

                    //Đơn vị
                    DropDownList drpUnit = (DropDownList)e.Row.FindControl("drpUnit");
                    if (drpUnit != null)
                    {
                        BuildControl.BuildDropDownList(LangInt, drpUnit, UtilityLocal.List.UnitMeasure, false, string.Empty, string.Empty);

                        //Set old value selected
                        Label lbUnit = (Label)e.Row.FindControl("lbUnit");
                        drpUnit.SelectedValue = lbUnit.Text;
                    }

                    Label   lbStartingDate  = (Label)e.Row.FindControl("lbStartingDate");
                    TextBox txtStartingDate = (TextBox)e.Row.FindControl("txtStartingDate");
                    txtStartingDate.Text = lbStartingDate.Text;

                    Label   lbEndingDate  = (Label)e.Row.FindControl("lbEndingDate");
                    TextBox txtEndingDate = (TextBox)e.Row.FindControl("txtEndingDate");
                    txtEndingDate.Text = lbEndingDate.Text;

                    Label   lbUnitPrice  = (Label)e.Row.FindControl("lbUnitPrice");
                    TextBox txtUnitPrice = (TextBox)e.Row.FindControl("txtUnitPrice");
                    txtUnitPrice.Text = lbUnitPrice.Text;
                    // lbUnitPrice.Text;

                    Label   lbDealPrice  = (Label)e.Row.FindControl("lbDealPrice");
                    TextBox txtDealPrice = (TextBox)e.Row.FindControl("txtDealPrice");
                    txtDealPrice.Text = lbDealPrice.Text;
                }
            }
        }
        private void DisplayWelcomeScreen()
        {
            this.projectFilePath = null;
            this.xmlLogFilePath  = null;
            this.currentBuild    = null;
            Title = DefaultTitle;
            var welcomeScreen = new WelcomeScreen();

            SetContent(welcomeScreen);
            welcomeScreen.RecentLogSelected     += log => OpenLogFile(log);
            welcomeScreen.RecentProjectSelected += project => BuildProject(project);
            welcomeScreen.OpenProjectRequested  += () => OpenProjectOrSolution();
            welcomeScreen.OpenLogFileRequested  += () => OpenLogFile();
            UpdateRecentItemsMenu();
        }
Пример #10
0
    public static void ShowDisplayBoard(BuildControl control, Vector3 position, string explain)
    {
        if (BuildMenu.board != null)
        {
            Destroy(BuildMenu.board);
            BuildMenu.board = null;
        }
        GameObject board = Resources.Load <GameObject>("prefabs/UI/BuildDisplayBoard");

        board = GameObject.Instantiate <GameObject>(board);
        board.GetComponent <DisplayBoard>().control = control;
        board.GetComponentInChildren <Text>().text  = explain;
        board.transform.SetParent(AppManage.Instance.HUD.transform, false);
        board.transform.SetAsFirstSibling();
        BuildMenu.board = board;
        // board.transform.position = Camera.main.WorldToScreenPoint(position);转到被点击建筑
    }
Пример #11
0
        /// <summary>
        /// Init page
        /// </summary>
        private void InitPage()
        {
            categoryId = Utils.GetParameter("cid", string.Empty);

            pcBll                   = new ProductBLL();
            genericBLL              = new Generic <PNK_Product>();
            generic2CBLL            = new Generic2C <PNK_Product, PNK_ProductDesc>();
            this.template_path      = WebUtils.GetWebPath();
            msg_confirm_delete_item = LocalizationUtility.GetText("mesConfirmDelete");
            msg_no_selected_item    = LocalizationUtility.GetText("mesSelectItem");
            LocalizationUtility.SetValueControl(this);

            //Bind drp hãng sản xuất
            BuildControl.BuildDropDownList(Constant.DB.LangId, drpBrand, UtilityLocal.List.Brand, true, " ", string.Empty);

            BindNewsCategory();
            GetMessage();
        }
Пример #12
0
        private void DisplayWelcomeScreen(string message = "")
        {
            this.projectFilePath = null;
            this.logFilePath     = null;
            this.currentBuild    = null;
            Title = DefaultTitle;

            var welcomeScreen = new WelcomeScreen();

            welcomeScreen.Message = message;
            SetContent(welcomeScreen);
            welcomeScreen.RecentLogSelected     += log => OpenLogFile(log);
            welcomeScreen.RecentProjectSelected += project => BuildProject(project);
            welcomeScreen.OpenProjectRequested  += () => OpenProjectOrSolution();
            welcomeScreen.OpenLogFileRequested  += () => OpenLogFile();
            welcomeScreen.PropertyChanged       += WelcomeScreen_PropertyChanged;
            UpdateRecentItemsMenu();
        }
Пример #13
0
        private void DisplayWelcomeScreen(string message = "")
        {
            this.projectFilePath = null;
            this.logFilePath     = null;
            this.currentBuild    = null;
            Title = DefaultTitle;

            var welcomeScreen = new WelcomeScreen();

            welcomeScreen.Message = message;
            SetContent(welcomeScreen);
            welcomeScreen.RecentLogSelected     += log => Dispatcher.UIThread.Post(() => OpenLogFile(log));
            welcomeScreen.RecentProjectSelected += project => Dispatcher.UIThread.Post(() => BuildProject(project));
            welcomeScreen.OpenProjectRequested  += async() => await OpenProjectOrSolution();

            welcomeScreen.OpenLogFileRequested += async() => await OpenLogFile();

            UpdateRecentItemsMenu();
        }
Пример #14
0
 private void LobbyViewModel_BuildingStarted(object sender, bool isHost)
 {
     if (isHost)
     {
         _listener = _lobbyViewModel.Server;
     }
     Dispatcher.Invoke(() =>
     {
         _buildViewModel              = new BuildViewModel(_client, _playerListViewModel, _lobbyViewModel.SelectedLayout);
         _buildViewModel.FlightBegun += BuildViewModel_FlightBegun;
         BuildControl buildControl    = new BuildControl
         {
             DataContext = _buildViewModel
         };
         _mainWindow.Content     = buildControl;
         _mainWindow.WindowState = WindowState.Maximized;
         _mainWindow.WindowStyle = WindowStyle.None;
     });
 }
        private void SetContent(object content)
        {
            mainContent.Content = content;
            if (content == null)
            {
                logFilePath     = null;
                projectFilePath = null;
                currentBuild    = null;
            }

            if (content is BuildControl)
            {
                ReloadMenu.IsVisible = logFilePath != null;
                SaveAsMenu.IsVisible = true;
            }
            else
            {
                ReloadMenu.IsVisible = false;
                SaveAsMenu.IsVisible = false;
            }
        }
        private void SetContent(object content)
        {
            mainContent.Content = content;
            if (content == null)
            {
                logFilePath     = null;
                projectFilePath = null;
                currentBuild    = null;
            }

            if (content is BuildControl)
            {
                ReloadMenu.Visibility = logFilePath != null ? Visibility.Visible : Visibility.Collapsed;
                SaveAsMenu.Visibility = Visibility.Visible;
            }
            else
            {
                ReloadMenu.Visibility = Visibility.Collapsed;
                SaveAsMenu.Visibility = Visibility.Collapsed;
            }
        }
Пример #17
0
    public void SetPlaceable(BuildingSO placeablePrefab)
    {
        //place = placeablePrefab.GetComponent<PlaceControl>();
        Vector3 mousePosition = Camera.main.ScreenToWorldPoint(Input.mousePosition);

        mousePosition.z = 0;
        placeable       = Instantiate(placeablePrefab.buildingPrefab, mousePosition, Quaternion.identity);
        placeable.GetComponent <CircleCollider2D>().isTrigger = true;
        placeable.GetComponent <CircleCollider2D>().radius   -= placeable.GetComponent <CircleCollider2D>().radius / 10;
        place = placeable.AddComponent <PlaceControl>();
        BuildControl build = placeable.GetComponent <BuildControl>();

        build.name              = placeablePrefab.objectName;
        build.durable           = placeablePrefab.durable;
        build.buildProgress     = buildProgress;
        build.dismantleProgress = dismantleProgress;
        build.dTime             = placeablePrefab.dTime;
        build.buildTime         = placeablePrefab.buildTime;
        build.type              = placeablePrefab.type;
        build.cost              = placeablePrefab.cost;

        // prefabToPlace = placeablePrefab;
    }
 private void Start()
 {
     build = originGO.GetComponent <BuildControl>();
     transform.position   = build.getOrigin().position;
     transform.localScale = new Vector3(3, 3, 3);
 }
Пример #19
0
 protected override void Awake()
 {
     base.Awake();
     controlForBuild = CptUtil.AddCpt<BuildControl>(gameObject);
     controlForBuild.ChangeMode(BuildControlModeEnum.Build);
 }