示例#1
0
    private void CreatePartsFromBuild(Double3 launchPadPosition)
    {
        Build.BuildSave buildSave = JsonUtility.FromJson <Build.BuildSave>(Ref.LoadJsonString(Saving.SaveKey.ToLaunch));
        PartGrid.PositionForLaunch(buildSave.parts, this.partDatabase, buildSave.rotation);
        List <Part> list  = CreateRocket.CreateBuildParts((launchPadPosition - Ref.positionOffset).toVector3, buildSave, this.partDatabase);
        List <Part> list2 = new List <Part>();

        for (int i = 0; i < list.Count; i++)
        {
            if (list[i].GetComponent <ControlModule>() != null)
            {
                list2.Add(list[i]);
            }
        }
        list2.AddRange(list);
        List <Vessel> list3 = this.CreateVesselsFromParts(list2, Vector2.zero, 0f, new Vessel.Throttle(false, 0.65f), new List <string>());

        Ref.mainVessel = null;
        Ref.mainVessel = list3[0];
        Ref.map.SelectVessel(list3[0], false);
        for (int j = 0; j < list.Count; j++)
        {
            list[j].UpdateConnected();
        }
        Ref.map.UpdateVesselsMapIcons();
        this.UpdateVesselButtons();
        this.RepositionFuelIcons();
    }
        private void bindGridData()
        {
            DataView view = DBHelper.createGridView(this.getSQL());

            PartGrid.DataSource   = view;
            PartGrid.DataKeyNames = new string[] { "objid", "rowversion" };
            PartGrid.DataBind();
        }
示例#3
0
        public static PartGrid getPrtGrid(double RequestDTStamp,
                                          int Page, int RowLimit, string SortIndex, string SortOrder, string Part_no, bool LtaPart, bool ViewHistory)
        {
            //Session Login Check
            if (HttpContext.Current.Session["Connection"] == null)
            {
                throw new Exception("Session State Timeout");
            }

            //Create paging request
            PartViewRequest gridRequest = new PartViewRequest();

            gridRequest.page        = Page;
            gridRequest.rows        = RowLimit;
            gridRequest.index       = SortIndex.ToLower();
            gridRequest.order       = SortOrder.ToLower();
            gridRequest.part_no     = (Part_no.ToUpper()).Trim();
            gridRequest.viewHistory = ViewHistory;

            //Validate request input
            if (!gridRequest._isValid())
            {
                //Return an empty grid
                PartGrid emptyGrid = new PartGrid();
                emptyGrid.totalPages  = 1;
                emptyGrid.currentPage = 1;
                emptyGrid.totalRows   = 0;
                emptyGrid.rows        = new List <PartGrid.Part>();

                return(emptyGrid);
            }

            //limit results to ccb
            gridRequest.role = "ccb";

            //Query database using request
            PartGrid result;

            using (Interface db = new Interface())
            {
                if (LtaPart)
                {
                    result = db.getLtaPartGrid(gridRequest);
                }
                else
                {
                    result = db.getCLSPartGrid(gridRequest);
                }
            }

            return(result);
        }
示例#4
0
 private bool InsertGrid(int x, int y, GuiVesselsPartGraphNode node)
 {
     // Grid koords [-4][-6] will be translated in list index [-4 - minX][-6 - minY]
     // so index will always be >= 0
     // Also keep the grid (list of lists) quadratic
     // On new min value create a new list, insert amount of blanks, append old list
     // and replace list by new list
     if (x < PartGridMinX)
     {
         int diffX = PartGridMinX - x;
         List <List <GuiVesselsPartGraphNode> > list = new List <List <GuiVesselsPartGraphNode> >();
         for (int i = 0; i < diffX; i++)
         {
             List <GuiVesselsPartGraphNode> l = new List <GuiVesselsPartGraphNode>();
             for (int j = PartGridMinY; j <= PartGridMaxY; j++)
             {
                 l.Add(null);
             }
             list.Add(l);
         }
         list.AddRange(PartGrid);
         PartGrid     = list;
         PartGridMinX = x;
     }
     if (y < PartGridMinY)
     {
         int diffY = PartGridMinY - y;
         for (int i = 0; i < PartGrid.Count; i++)
         {
             List <GuiVesselsPartGraphNode> list = new List <GuiVesselsPartGraphNode>();
             for (int j = 0; j < diffY; j++)
             {
                 list.Add(null);
             }
             list.AddRange(PartGrid[i]);
             PartGrid[i] = list;
         }
         PartGridMinY = y;
     }
     if (x > PartGridMaxX)
     {
         int diffX = x - PartGridMaxX;
         for (int i = 0; i < diffX; i++)
         {
             List <GuiVesselsPartGraphNode> list = new List <GuiVesselsPartGraphNode>();
             for (int j = PartGridMinY; j <= PartGridMaxY; j++)
             {
                 list.Add(null);
             }
             PartGrid.Add(list);
         }
         PartGridMaxX = x;
     }
     if (y > PartGridMaxY)
     {
         int diffY = y - PartGridMaxY;
         for (int i = 0; i < PartGrid.Count; i++)
         {
             for (int j = 0; j < diffY; j++)
             {
                 PartGrid[i].Add(null);
             }
         }
         PartGridMaxY = y;
     }
     if (PartGrid[x - PartGridMinX][y - PartGridMinY] == null)
     {
         PartGrid[x - PartGridMinX][y - PartGridMinY] = node;
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#5
0
 private void Start()
 {
     PartGrid.LoadIcon(this.iconPrefab, this.partToLoad.prefab, -(this.partToLoad.centerOfRotation * this.partToLoad.pickGridScale), Vector2.one * this.partToLoad.pickGridScale, base.transform, 50, Color.white, false);
 }
 private void GVEmptyDataBind()
 {
     PartGrid.DataSource = null;
     PartGrid.DataBind();
 }