예제 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
     {
         intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
     }
     else
     {
         Reload();
     }
     oBuildLocation = new BuildLocation(intProfile, dsn);
     oZone          = new Zones(intProfile, dsn);
     oLocation      = new Locations(intProfile, dsn);
     oRoom          = new RoomsNew(intProfile, dsn);
     btnClose.Attributes.Add("onclick", "return HidePanel();");
     if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
     {
         intBuildLocationRDP = Int32.Parse(Request.QueryString["id"]);
     }
     if (!IsPostBack)
     {
         if (intBuildLocationRDP > 0)
         {
             Int32.TryParse(oBuildLocation.GetRDP(intBuildLocationRDP, "addressid"), out intAddress);
             lblName.Text = oLocation.GetFull(intAddress);
         }
         LoadRooms();
     }
 }
예제 #2
0
    public void BuildTower(BuildLocation spawnPos)
    {
        Tower towerInstance = Instantiate(towerPrefab, spawnPos.transform.position, Quaternion.identity, transform);

        towerQueue.Enqueue(towerInstance);
        towerInstance.builtPosition = spawnPos;
        spawnPos.GetComponent <BuildLocation>().SetLocationStatus(true);
    }
예제 #3
0
 public void PreCheckTowerPlacement(BuildLocation buildLocation)
 {
     if (gameStarted)
     {
         FindObjectOfType <UIControl>().DisplayErrorText("Can not build once the round has started."); return;
     }
     if (buildLocation.GetLocationStatus())
     {
         FindObjectOfType <UIControl>().DisplayErrorText("Tower already placed here."); return;
     }
     CheckToMoveOrBuild(buildLocation);
 }
 public void GetSelection(GameObject selection)
 {
     if (selection.GetComponent <BuildLocation>())
     {
         BuildLocation buildlocation = selection.GetComponent <BuildLocation>();
         FindObjectOfType <TowerSpawner>().PreCheckTowerPlacement(buildlocation);
     }
     else
     {
         FindObjectOfType <UIControl>().DisplayErrorText("Can't build here! This is a " + selection.name.Substring(0, selection.name.Length - (selection.name.Length - 4)) + ".");
     }
 }
예제 #5
0
    private void MoveTower(BuildLocation spawnPos)
    {
        Tower movedTower = towerQueue.Dequeue();

        towerQueue.Enqueue(movedTower);
        if (movedTower.builtPosition != null)
        {
            movedTower.builtPosition.SetLocationStatus(false);
        }
        movedTower.transform.position = spawnPos.transform.position;
        spawnPos.SetLocationStatus(true);
        movedTower.builtPosition = spawnPos;
    }
예제 #6
0
    void Start()
    {
        parent = transform.parent.GetComponent<BuildLocation>();
        spriteEnabled = true;
        renderer = GetComponent<SpriteRenderer>();

        if (defaultPlayer == null) {
            if (Game.p1Turn) {
                player = GameObject.FindGameObjectWithTag ("Player 1");
            } else {
                player = GameObject.FindGameObjectWithTag ("Player 2");
            }
        } else {
            player = defaultPlayer;
        }
    }
예제 #7
0
 private void CheckToMoveOrBuild(BuildLocation buildLocation)
 {
     if (towerQueue.Count < towerLimit)
     {
         BuildTower(buildLocation);
         currentTowersInPlay++;
         UpdateTowerCountText();
     }
     else
     {
         MoveTower(buildLocation);
         if (currentTowersInPlay < towerLimit)
         {
             currentTowersInPlay++;
         }
         UpdateTowerCountText();
     }
 }
        private void DrawBuild()
        {
            EditorGUILayout.BeginVertical(EditorStyles.helpBox);
            {
                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    GUILayout.Label("Build Summary", EditorStyles.boldLabel);
                    GUILayout.FlexibleSpace();
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();
                    if (GUILayout.Button(
                            new GUIContent(
                                "Change location",
                                "Button open Build Settings window."),
                            GUILayout.Width(110)))
                    {
                        Dispatch(() => ChangeBuildLocation());
                    }
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.BeginHorizontal();
                {
                    string shortPath = BuildLocation;
                    if (BuildLocation == null)
                    {
                        shortPath = "(not set)";
                    }
                    else
                    {
                        if (BuildLocation.Length > 50)
                        {
                            shortPath = BuildLocation.Substring(0, 20) +
                                        "..." +
                                        BuildLocation.Substring(
                                BuildLocation.Length - 20,
                                20);
                        }
                    }


                    GUILayout.Label("Location:");
                    GUILayout.FlexibleSpace();
                    GUILayout.Label(
                        new GUIContent(shortPath, BuildLocation),
                        EditorStyles.miniLabel);
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Separator();
                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.Label("Scenes: ", EditorStyles.boldLabel);
                    if (GUILayout.Button(
                            new GUIContent(
                                "Edit Scenes",
                                "Button open Build Settings window."),
                            GUILayout.Width(110)))
                    {
                        Dispatch(() => SwitchScenes());
                    }
                }
                EditorGUILayout.EndHorizontal();

                string[] scenes = AppBuild.Scenes.ToArray();

                for (int i = 0; i < scenes.Length; i++)
                {
                    GUILayout.Label(i + ". " + scenes[i]);
                }
            }
            EditorGUILayout.EndVertical();
            EditorGUILayout.Space();
        }
예제 #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/forecast/build_locations.aspx";
            Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }
            oBuildLocation = new BuildLocation(intProfile, dsn);
            oLocation      = new Locations(intProfile, dsn);
            oModel         = new Models(intProfile, dsn);
            oClass         = new Classes(intProfile, dsn);

            int intLocationFinal = intLocation;
            int intLocationBuild = intLocation;

            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                LoopRepeater();
            }
            else
            {
                intID = Int32.Parse(Request.QueryString["id"]);
                if (intID == 0)
                {
                    panAdd.Visible    = true;
                    btnDelete.Enabled = false;
                }
                else
                {
                    panAdd.Visible = true;
                    if (!IsPostBack)
                    {
                        DataSet ds            = oBuildLocation.Get(intID);
                        int     intClassFinal = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["classid"].ToString(), out intClassFinal);
                        ddlClass.SelectedValue        = intClassFinal.ToString();
                        ddlEnvironment.Enabled        = true;
                        ddlEnvironment.DataTextField  = "name";
                        ddlEnvironment.DataValueField = "id";
                        ddlEnvironment.DataSource     = oClass.GetEnvironment(intClassFinal, 0);
                        ddlEnvironment.DataBind();
                        ddlEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        int intEnvironmentFinal = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["environmentid"].ToString(), out intEnvironmentFinal);
                        ddlEnvironment.SelectedValue = intEnvironmentFinal.ToString();
                        hdnEnvironmentFinal.Value    = intEnvironmentFinal.ToString();
                        Int32.TryParse(ds.Tables[0].Rows[0]["addressid"].ToString(), out intLocationFinal);

                        int intClassBuild = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["build_classid"].ToString(), out intClassBuild);
                        ddlClassBuild.SelectedValue        = intClassBuild.ToString();
                        ddlEnvironmentBuild.Enabled        = true;
                        ddlEnvironmentBuild.DataTextField  = "name";
                        ddlEnvironmentBuild.DataValueField = "id";
                        ddlEnvironmentBuild.DataSource     = oClass.GetEnvironment(intClassBuild, 0);
                        ddlEnvironmentBuild.DataBind();
                        ddlEnvironmentBuild.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        int intEnvironmentBuild = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["build_environmentid"].ToString(), out intEnvironmentBuild);
                        ddlEnvironmentBuild.SelectedValue = intEnvironmentBuild.ToString();
                        hdnEnvironmentBuild.Value         = intEnvironmentBuild.ToString();
                        Int32.TryParse(ds.Tables[0].Rows[0]["build_addressid"].ToString(), out intLocationBuild);

                        int intModel = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["modelid"].ToString(), out intModel);
                        lblModel.Text  = oModel.Get(intModel, "name");
                        hdnModel.Value = intModel.ToString();

                        chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnAdd.Text        = "Update";
                    }
                }
            }

            strLocationFinal       = oLocation.LoadDDL("ddlStateFinal", "ddlCityFinal", "ddlAddressFinal", hdnLocationFinal.ClientID, intLocationFinal, true, "ddlCommonFinal");
            hdnLocationFinal.Value = intLocationFinal.ToString();
            strLocationBuild       = oLocation.LoadDDL("ddlStateBuild", "ddlCityBuild", "ddlAddressBuild", hdnLocationBuild.ClientID, intLocationBuild, true, "ddlCommonBuild");
            hdnLocationBuild.Value = intLocationBuild.ToString();
            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            btnModel.Attributes.Add("onclick", "return OpenWindow('MODELBROWSER','" + hdnModel.ClientID + "','&control=" + hdnModel.ClientID + "&controltext=" + lblModel.ClientID + "',false,400,600);");
            ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
            ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironmentFinal.ClientID + "');");
            ddlClassBuild.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironmentBuild.ClientID + "',0);");
            ddlEnvironmentBuild.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironmentBuild.ClientID + "','" + hdnEnvironmentBuild.ClientID + "');");
        }
예제 #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.Cookies["loginreferrer"].Value   = "/admin/forecast/build_locations_rdp.aspx";
            Response.Cookies["loginreferrer"].Expires = DateTime.Now.AddDays(30);
            if (Request.Cookies["adminid"] != null && Request.Cookies["adminid"].Value != "")
            {
                intProfile = Int32.Parse(Request.Cookies["adminid"].Value);
            }
            else
            {
                Response.Redirect("/admin/login.aspx");
            }
            oBuildLocation = new BuildLocation(intProfile, dsn);
            oClass         = new Classes(intProfile, dsn);
            oLocation      = new Locations(intProfile, dsn);
            oResiliency    = new Resiliency(intProfile, dsn);

            if (!IsPostBack)
            {
                LoadLists();
            }

            if (Request.QueryString["id"] == null)
            {
                LoopRepeater();
            }
            else
            {
                intID = Int32.Parse(Request.QueryString["id"]);
                if (intID == 0)
                {
                    panAdd.Visible    = true;
                    btnDelete.Enabled = false;
                }
                else
                {
                    panAdd.Visible = true;
                    if (!IsPostBack)
                    {
                        DataSet ds       = oBuildLocation.GetRDP(intID);
                        int     intClass = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["classid"].ToString(), out intClass);
                        ddlClass.SelectedValue        = intClass.ToString();
                        ddlEnvironment.Enabled        = true;
                        ddlEnvironment.DataTextField  = "name";
                        ddlEnvironment.DataValueField = "id";
                        ddlEnvironment.DataSource     = oClass.GetEnvironment(intClass, 0);
                        ddlEnvironment.DataBind();
                        ddlEnvironment.Items.Insert(0, new ListItem("-- SELECT --", "0"));
                        int intEnv = 0;
                        Int32.TryParse(ds.Tables[0].Rows[0]["environmentid"].ToString(), out intEnv);
                        ddlEnvironment.SelectedValue = intEnv.ToString();
                        hdnEnvironment.Value         = intEnv.ToString();
                        Int32.TryParse(ds.Tables[0].Rows[0]["addressid"].ToString(), out intLocation);
                        txtRDP_Schedule_WS.Text             = ds.Tables[0].Rows[0]["rdp_schedule_ws"].ToString();
                        txtRDP_Computer_WS.Text             = ds.Tables[0].Rows[0]["rdp_computer_ws"].ToString();
                        txtRDP_MDT_WS.Text                  = ds.Tables[0].Rows[0]["rdp_mdt_ws"].ToString();
                        txtJumpstartCGI.Text                = ds.Tables[0].Rows[0]["jumpstart_cgi"].ToString();
                        ddlJumpstartBuildType.SelectedValue = ds.Tables[0].Rows[0]["jumpstart_build_type"].ToString();
                        txtBladeVLAN.Text           = ds.Tables[0].Rows[0]["blade_vlan"].ToString();
                        txtVMwareVLAN.Text          = ds.Tables[0].Rows[0]["vmware_vlan"].ToString();
                        txtVSphereVLAN.Text         = ds.Tables[0].Rows[0]["vsphere_vlan"].ToString();
                        txtDellVLAN.Text            = ds.Tables[0].Rows[0]["dell_vlan"].ToString();
                        txtDellVmwareVLAN.Text      = ds.Tables[0].Rows[0]["dell_vmware_vlan"].ToString();
                        ddlResiliency.SelectedValue = ds.Tables[0].Rows[0]["resiliencyid"].ToString();
                        ddlSource.SelectedValue     = ds.Tables[0].Rows[0]["source"].ToString();
                        chkServerAltiris.Checked    = (ds.Tables[0].Rows[0]["server_altiris"].ToString() == "1");
                        chkServerMDT.Checked        = (ds.Tables[0].Rows[0]["server_mdt"].ToString() == "1");
                        chkWorkstation.Checked      = (ds.Tables[0].Rows[0]["workstation"].ToString() == "1");
                        chkZones.Checked            = (ds.Tables[0].Rows[0]["zones"].ToString() == "1");
                        btnZones.Enabled            = chkZones.Checked;

                        chkEnabled.Checked = (ds.Tables[0].Rows[0]["enabled"].ToString() == "1");
                        btnAdd.Text        = "Update";
                    }
                }
            }

            strLocation       = oLocation.LoadDDL("ddlState", "ddlCity", "ddlAddress", hdnLocation.ClientID, intLocation, true, "ddlCommon");
            hdnLocation.Value = intLocation.ToString();
            ddlClass.Attributes.Add("onchange", "PopulateEnvironments('" + ddlClass.ClientID + "','" + ddlEnvironment.ClientID + "',0);");
            ddlEnvironment.Attributes.Add("onchange", "UpdateDropDownHidden('" + ddlEnvironment.ClientID + "','" + hdnEnvironment.ClientID + "');");
            btnDelete.Attributes.Add("onclick", "return confirm('Are you sure you want to delete this item?');");
            btnZones.Attributes.Add("onclick", "return OpenWindow('RDP_ZONES','','" + intID.ToString() + "',false,'650',500);");
        }