示例#1
0
        public void Spawn(PartData partData)
        {
            Data = partData;

            mainRenderer.sprite = partData.Image.Image;
            mainRenderer.color  = partData.Image.Color;

            var sequence = DOTween.Sequence();

            var flyY = transform.position.y + config.FlyYRange.GetRandom();
            var layY = transform.position.y + config.LayYRange.GetRandom();
            var layX = transform.position.x + config.LayXRange.GetRandom();

            mainRenderer.transform.position   = mainRenderer.transform.position + Vector3.up * config.StartYOffset;
            mainRenderer.transform.localScale = Vector3.zero;

            sequence.Append(mainRenderer.transform.DOMoveY(flyY, config.FlyUpDuration).SetEase(Ease.InQuad));
            sequence.Append(mainRenderer.transform.DOMoveY(layY, config.FlyDownDuration).SetEase(Ease.OutBounce));
            sequence.Insert(0f, mainRenderer.transform.DOMoveX(layX, config.FlyDuration));
            sequence.Insert(0f, mainRenderer.transform.DOScale(Vector3.one, config.FlyDuration));

            if (!partData.IsCollection)
            {
                sequence.AppendInterval(config.LayDownDuration);
                sequence.AppendCallback(Collect);
            }

            sequence.Play();
        }
示例#2
0
    public void loadChassis(string partName)
    {
        removePart("Chassis");

        GameObject c = Instantiate(PartData.findChassis(partName)) as GameObject;

        //robot.AddComponent<Robot> ();
        c.transform.SetParent(robot.transform);

        r.wheelAnchors = new GameObject[4];
        r.wheels       = new Wheel[4];
        r.armAnchors   = new GameObject[1];
        int count = 0;

        foreach (Transform t in c.transform)
        {
            if (t.gameObject.tag == "Anchor" && t.gameObject.name == "WheelAnchor")
            {
                r.wheelAnchors [count] = t.gameObject;
                count++;
            }
            if (t.gameObject.tag == "Anchor" && t.gameObject.name == "ArmAnchor")
            {
                r.armAnchors [0] = t.gameObject;
            }
        }
        c.name = "Chassis";
    }
        public void OnCraftStructureChanged()
        {
            //Debug.Log ("Craft Structure Changed");
            //if (_ActiveTool != null) Debug.Log ("ActiveTool : " + _ActiveTool.Name);
            //else Debug.Log ("No Active Tool");
            //if (_Designer.DesignerUi.Flyouts.PartProperties.IsOpen) Debug.Log ("Part Property Open");
            //else Debug.Log ("Part Property Close");

            //Debug.Log ("Selected Part count: " + _SelectedParts.Count);
            if (_SelectedParts.Count > 0 && _SelectedPart != null)
            {
                PartStateChange Change;

                Change = GetTransformChange(_PrevPartState, _SelectedPart.Data);
                if (Change == null && _Designer.DesignerUi.Flyouts.PartProperties.IsOpen)
                {
                    Change = GetChangedProperty(_PrevPartState, _SelectedPart.Data);
                }

                if (Change != null)
                {
                    ApplyChange(Change);
                    _PrevPartState = ClonePartData(_SelectedPart.Data);
                } //else Debug.Log ("Part State Not Changed");

                //_PrevPartState = new PartState (_SelectedPart.Data);
            }
        }
    public void FullTriangleTest()
    {
        // Add a traingle to a hexagon, then test traingle
        PartData partData = new PartData();
        Part     player   = new Part {
            shape = new GameObject(), type = 1
        };
        Part triangle = new Part {
            shape = new GameObject(), type = 0
        };
        AxialCoordinate playerCoord = new AxialCoordinate {
            x = 0, y = 0
        };
        AxialCoordinate triangleCoord = new AxialCoordinate {
            x = -1, y = 0
        };

        partData.addPart(playerCoord, player);
        partData.addPart(triangleCoord, triangle);

        // Get all full neighbours (ie, places to attach objects - there should be
        // 1 for a triangle)
        List <AxialCoordinate> neighbours = partData.getFullNeighbors(triangleCoord);

        // If 1 object attached, pass
        Assert.True(neighbours.Count == 1);
    }
示例#5
0
    private static Part[] LoadParts(GameSaving.VesselSave vesselToLoad)
    {
        int num = vesselToLoad.parts.Length;

        PartData[] array  = new PartData[num];
        Part[]     array2 = new Part[num];
        for (int i = 0; i < num; i++)
        {
            array[i]              = Ref.controller.partDatabase.GetPartByName(vesselToLoad.parts[i].partName);
            array2[i]             = UnityEngine.Object.Instantiate <Transform>(array[i].prefab, Vector3.zero, Quaternion.identity).GetComponent <Part>();
            array2[i].orientation = vesselToLoad.parts[i].orientation;
        }
        for (int j = 0; j < vesselToLoad.joints.Length; j++)
        {
            Part.Joint.Save save = vesselToLoad.joints[j];
            if (save.fromPartId != -1 && save.toPartId != -1)
            {
                new Part.Joint(save.anchor, array2[save.fromPartId], array2[save.toPartId], save.fromSurfaceIndex, save.toSurfaceIndex, save.fuelFlow);
            }
        }
        for (int k = 0; k < num; k++)
        {
            array2[k].UpdateConnected();
        }
        return(array2);
    }
    public void PathExistsTest()
    {
        // Add a row of three hexagons including player
        PartData partData = new PartData();
        Part     player   = new Part {
            shape = new GameObject(), type = 1
        };
        Part hexagon = new Part {
            shape = new GameObject(), type = 0
        };
        AxialCoordinate playerCoord = new AxialCoordinate {
            x = 0, y = 0
        };
        AxialCoordinate hexCoord = new AxialCoordinate {
            x = -1, y = 0
        };
        AxialCoordinate hex2Coord = new AxialCoordinate {
            x = -2, y = 1
        };

        partData.addPart(playerCoord, player);
        partData.addPart(hexCoord, hexagon);
        partData.addPart(hex2Coord, hexagon);

        // Find all destroyed parts if middle hexagon hit
        List <AxialCoordinate> neighbours = partData.findDestroyedPartLocations(hexCoord);

        // If 2 object destroyed, pass
        Assert.True(neighbours.Count == 2);
    }
        private IList <PartData> FormWeldedParts(DataTable dataTable)
        {
            List <PartData> list = new List <PartData>();

            dataTable.Columns.Add("typeTranslated", typeof(String));

            foreach (DataRow row in dataTable.Rows)
            {
                if (row.Field <string>("type") != "Component")
                {
                    row.SetField(
                        "typeTranslated",
                        Resources.ResourceManager.GetString(row.Field <string>("type")));
                }
                else
                {
                    row.SetField(
                        "typeTranslated",
                        row.Field <string>("componentTypeName"));
                }

                PartData p = new PartData()
                {
                    Id                  = row.Field <Guid>("id"),
                    Number              = row.Field <string>("number"),
                    PartType            = (PartType)Enum.Parse(typeof(PartType), row.Field <string>("type")),
                    Length              = row.Field <int>("length"),
                    PartTypeDescription = row.Field <string>("typeTranslated")
                };

                list.Add(p);
            }

            return(list);
        }
        public Tuple <GameObject, Transform> BuildBeam(PartData partData, Transform parent)
        {
            // Create object
            var beamGo = Instantiate(beamPrefab, parent);

            // Find next parent
            Transform nextParent = null;

            foreach (Transform child in beamGo.transform)
            {
                if (child.name == "End")
                {
                    nextParent = child;
                    break;
                }
            }

            // Set size
            var newScale = new Vector3(1, partData.Length / _resultingScale.y, 1);

            beamGo.transform.localScale = newScale;
            _resultingScale             = new Vector3(
                newScale.x * _resultingScale.x,
                newScale.y * _resultingScale.y,
                newScale.z * _resultingScale.z
                );

            return(Tuple.Create(beamGo, nextParent));
        }
    public void FullPlayerTest()
    {
        // Add a heaxgon to player, then test player
        PartData partData = new PartData();
        Part     player   = new Part {
            shape = new GameObject(), type = 1
        };
        Part hexagon = new Part {
            shape = new GameObject(), type = 0
        };
        AxialCoordinate playerCoord = new AxialCoordinate {
            x = 0, y = 0
        };
        AxialCoordinate hexCoord = new AxialCoordinate {
            x = -1, y = 0
        };

        partData.addPart(playerCoord, player);
        partData.addPart(hexCoord, hexagon);

        // Get all attached neighbours
        List <AxialCoordinate> neighbours = partData.getFullNeighbors(playerCoord);

        // If 1 attached neighbour, pass
        Assert.True(neighbours.Count == 1);
    }
示例#10
0
    internal void Refresh(PartData partData)
    {
        m_ID  = partData.ID;
        m_URL = partData.Link;
        if (IsPublicCamera)
        {
            return;
        }
        transform.position   = partData.Pos;
        transform.rotation   = partData.Rot;
        transform.localScale = Vector3.one * partData.ScaleValue;

        if (partData.IsHideLandMark)
        {
            var markobj = transform.Find("Landmark");
            if (null != markobj)
            {
                markobj.gameObject.SetActive(false);
            }
        }

        HUDName = partData.Name;
        if (null != HUD)
        {
            HUD.text = HUDName;
            if (null == m_str)
            {
                m_str            = HUD.transform.parent.gameObject.AddComponent <_LookAtCamera>();
                m_str.CameraTran = CameraController.GetInstance().MainCamera.transform;
            }
        }
    }
示例#11
0
    private IEnumerator EndGachaAnimation()
    {
        skipButton.SetActive(false);

        // set to position
        animatingPart.position = Vector3.zero;

        // set flavor text & name
        flavorTextBg.SetActive(true);
        flavorText.gameObject.SetActive(true);
        nameText.gameObject.SetActive(true);

        PartData partData = PartsTable.Instance.GetPartData(animatingPart.GetComponent <BasePart>().name);

        flavorText.text = "\"" + partData.flavorText + "\"";
        nameText.text   = partData.name;

        yield return(new WaitForSeconds(1f));

        if (isSingleSummon)
        {
            doneButton.SetActive(true);
        }
        else
        {
            gachaButton.SetActive(true);
        }
    }
示例#12
0
        public void ApplyXmlData(List <XElement> modifers)
        {
            XElement Part = modifers.Find(m => m.Name == "Part");
            PartData data = _designer.CraftScript.Data.Assembly.Parts.ToList().Find(part => part.Id == int.Parse(Part.Attribute("id").Value));
            List <PartConnection> oldConns = data.PartConnections;
            List <AttachPoint>    oldAPs   = data.AttachPoints;

            modifers.Remove(Part);
            modifers.ForEach(m => Part.Descendants().Append(m));

            _partDataConstructor.Invoke(data, new object[] { Part, data.PartScript.CraftScript.Data.XmlVersion, data.PartType });

            data.SetP("PartConnections", oldConns);
            data.SetP("AttachPoints", oldAPs);

            ISymmetrySlice oldSlice = data.PartScript.SymmetrySlice;

            UnityEngine.Object.Destroy(data.PartScript.GameObject);
            CraftBuilder.CallS("CreatePartGameObjects", new PartData[1] {
                data
            }, Game.Instance.Designer.CraftScript);

            data.PartScript.SymmetrySlice = oldSlice;
            Symmmetry.CallS("SynchronizeParts", data.PartScript, true);

            _selectorManager.ignoreNextStructureChangedEvent = true;
            Game.Instance.Designer.CraftScript.RaiseDesignerCraftStructureChangedEvent();
        }
示例#13
0
        public List <XElement> GetModifiers(PartData part)
        {
            XElement data = part.GenerateXml(part.PartScript.CraftScript.Transform, false);

            data.SetAttributeValue("activated", part.Activated);
            return(data.DescendantsAndSelf().ToList());
        }
        public void rptCustPartHeader_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                PartData        partData = (PartData)e.Item.DataItem;
                List <PartData> partList = new List <PartData>();
                partList.Add(partData);
                Label lbl = (Label)e.Item.FindControl("lblLocation");
                lbl.Text = partData.CustomerPlant.PLANT_NAME;

                Repeater rpt = (Repeater)e.Item.FindControl("rptCustPartDetail");
                rpt.DataSource = partList;
                rpt.DataBind();
                LinkButton lnk = (LinkButton)rpt.Items[0].FindControl("lnkPartList");
                lnk.CommandArgument = partData.CustomerPlant.PLANT_ID.ToString();
                lnk = (LinkButton)rpt.Items[0].FindControl("lnkSaveCust");
                lnk.CommandArgument = partData.CustomerPlant.PLANT_ID.ToString();

                lbl      = (Label)rpt.Items[0].FindControl("lblLocationCode");
                lbl.Text = partData.CustomerPlant.DUNS_CODE;
                lbl      = (Label)rpt.Items[0].FindControl("lblParentCompany");
                lbl.Text = partData.PartnerCompany.COMPANY_NAME;

                HiddenField hf   = (HiddenField)rpt.Items[0].FindControl("hfQSNotify");
                RadComboBox ddl1 = (RadComboBox)rpt.Items[0].FindControl("ddlQSNotify1");
                SQMBasePage.SetPersonList(ddl1, staticPersonList, "", 20);
                RadComboBox ddl2 = (RadComboBox)rpt.Items[0].FindControl("ddlQSNotify2");
                SQMBasePage.SetPersonList(ddl2, staticPersonList, "", 20);
            }
        }
示例#15
0
        public PartDataWhole TransformToPartsList(JoinType joinType, Transform trans, int selctIndex, byte[] pixels, byte[] drawPixel, byte[] drawTexture)
        {
            List <PartData> parts = new List <PartData>();

            ResDragItem [] transList = trans.GetComponentsInChildren <ResDragItem>();
            for (int i = 0; i < transList.Length; i++)
            {
                Transform img = transList[i].transform;
                if (img.GetComponent <Image>().sprite == null)
                {
                    continue;
                }
                PartType type  = transList[i].partType;
                byte[]   b     = img.GetComponent <Image>().sprite.texture.EncodeToPNG();
                float[]  pos   = { img.localPosition.x, img.localPosition.y, img.localPosition.z };
                float[]  scale = { img.localScale.x, img.localScale.y, img.localScale.z };
                PartData p     = new PartData(type, b, pos, scale);
                parts.Add(p);
            }
            PartDataWhole partDataWhole = new PartDataWhole(joinType, selctIndex, pixels, drawPixel, parts, drawTexture);

            GameManager.instance.SetCurPartDataWhole(partDataWhole);

            //序列化
            PersonManager.instance.SerializePerson(partDataWhole);
            return(partDataWhole);
        }
示例#16
0
    private void CreateGUI()
    {
        this.ClearNewbuttons();
        int        num        = 0;
        int        num2       = 0;
        GameObject gameObject = new GameObject("Pivot");

        gameObject.transform.parent        = base.transform;
        gameObject.transform.localPosition = Vector3.zero;
        this.scrollPivot = gameObject.transform;
        for (int i = 0; i < this.partOrder.Count; i++)
        {
            BasePart.PartType partType = this.partOrder[i];
            if (this.ValidPart(partType))
            {
                float    num3     = (float)num * this.horizontalPadding + (float)num2 * this.partPadding;
                PartData partData = this.parts[partType];
                this.totalWidth = num3 + (float)(partData.RowWidth() - 1) * this.horizontalPadding;
                this.CreatePartIcons(partData, num3, gameObject.transform, this.newButtons);
                num2++;
                num += partData.RowWidth();
            }
        }
        this.scrollPivot.localPosition = new Vector3(this.GetTargetPosition(), this.scrollPivot.localPosition.y, this.scrollPivot.localPosition.z);
        this.targetPosition            = this.GetTargetPosition();
        this.InitNewButtons();
    }
 private void HandlePartCollected(PartData part)
 {
     if (!notificationView.Shown && modelController.CanCreateAnyItem())
     {
         notificationView.Show();
     }
 }
示例#18
0
        private PartData CollectRandomPart()
        {
            PartData spawned = null;

            var currentValue = 0f;
            var spawnValue   = Random.value * GetSpawnValue();

            foreach (var part in modelController.GetAllParts())
            {
                if (modelController.CanCollectPart(part))
                {
                    currentValue += part.SpawnRatio;
                    if (spawnValue < currentValue)
                    {
                        spawned = part;
                        break;
                    }
                }
            }

            return(new PartData
            {
                Id = spawned.Id,
                Name = spawned.Name,
                Image = spawned.Image,
                Count = 1
            });
        }
示例#19
0
//    private string currAnimName;
//    private bool isInit;

    void Awake()
    {
        _skelList = new List <SkeletonAnimation>();

        for (int i = 0; i < boneNames.Length; i++)
        {
            roleBoneData[boneNames[i]] = i + 1;
        }

        PartData data = new PartData()
        {
            partResName = "RegionWing",
            atlasName   = "dragon-pma",
            regionName  = "left-wing03",
            slotName    = "right-wing"
        };

        partDataDic[1] = data;

        data = new PartData()
        {
            partResName = "MeshWing",
            atlasName   = "dragon-pma",
            regionName  = "left-wing03",
            slotName    = "left-wing"
        };
        partDataDic[2] = data;
    }
示例#20
0
    private PartData transcribePart(Part part)
    {
        PartData partData = new PartData();

        partData.partTypeId  = UniTable.classGuid[part.GetType()].ToString();
        partData.displayName = part.displayName;
        partData.partId      = part.partId.ToString();

        if (null != part.owner)
        {
            partData.ownerId = part.owner.unitId.ToString();
        }

        partData.slots = new List <Part.slot>();
        foreach (Part.slot s in part.slots)
        {
            partData.slots.Add(s);
        }

        partData.baseAtt    = new attributes(part.baseAtt);
        partData.abilityIds = new List <String>();
        foreach (ability a in part.abilities)
        {
            partData.abilityIds.Add(UniTable.classGuid[a.GetType()].ToString());
        }

        return(partData);
    }
示例#21
0
        public static bool GetPartData(out List <PartData> listPartData)
        {
            IList <Com_PEMain> listComPEMain = session.QueryOver <Com_PEMain>().List();

            listPartData = new List <PartData>();
            try
            {
                foreach (Com_PEMain i in listComPEMain)
                {
                    PartData sPartData = new PartData();
                    sPartData.CustomerName = session.QueryOver <Sys_Customer>()
                                             .Where(x => x.customerSrNo == i.sysCustomer.customerSrNo).SingleOrDefault().customerName;
                    sPartData.PartNo = i.partName;
                    if (listPartData.Contains(sPartData))
                    {
                        continue;
                    }
                    listPartData.Add(sPartData);
                }
            }
            catch (System.Exception ex)
            {
                return(false);
            }
            return(true);
        }
 public Vector3 LocalVelocity(PartData pd)
 {
     if (pd.aeroModule.part == null || pd.aeroModule.part.partTransform == null)
     {
         return(Vector3.zero);
     }
     return(pd.aeroModule.part.partTransform.InverseTransformVector(worldVel));
 }
示例#23
0
 void SetAllAttached(bool attached)
 {
     for (int i = 0; i < parts.items.Length; i++)
     {
         PartData part = parts.items[i];
         SetAttached(part, attached);
     }
 }
示例#24
0
 public void Detach(PartData partData, Vector3?worldForce = null)
 {
     SetAttached(partData, false);
     if (worldForce != null)
     {
         ApplyForce(partData, worldForce.Value);
     }
 }
示例#25
0
        public Tuple <GameObject, Transform> BuildRevoluteJoint(PartData partData, Transform parent)
        {
            var jointGo = Instantiate(revoluteJointPrefab, parent);

            jointGo.transform.Rotate(0, partData.RotationY, 0);
            jointGo.GetComponent <RevoluteJoint>().Setup(partData.MinAngle, partData.MaxAngle, partData.InitialAngle);
            return(Tuple.Create(jointGo, parent));
        }
示例#26
0
 protected void OnPartAdd(object sender, EventArgs e)
 {
     staticPartData       = new PartData();
     staticPartData.IsNew = true;
     staticPartData.Part  = SQMModelMgr.CreatePart(SessionManager.PrimaryCompany().COMPANY_ID, SessionManager.UserContext.UserName());
     // ClearTempData();
     DisplayPart();
 }
        public void rptProgramPart_OnItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.Item)
            {
                try
                {
                    PartData partData = (PartData)e.Item.DataItem;
                    PLANT    plant    = null;
                    Label    lbl1     = (Label)e.Item.FindControl("lblPartSource");
                    Label    lbl2     = (Label)e.Item.FindControl("lblPartSourceCode");

                    if (partData.Used.SUPP_PLANT_ID.HasValue)
                    {
                        if ((plant = staticPlantList.Where(l => l.PLANT_ID == partData.Used.SUPP_PLANT_ID).SingleOrDefault()) == null)
                        {
                            staticPlantList.Add((plant = SQMModelMgr.LookupPlant((decimal)partData.Used.SUPP_PLANT_ID)));
                        }
                        lbl1.Text = plant.PLANT_NAME;
                        lbl2.Text = plant.ADDRESS.FirstOrDefault().CITY;
                    }
                    else
                    {
                        if ((plant = staticPlantList.Where(l => l.PLANT_ID == partData.Used.PLANT_ID).SingleOrDefault()) == null)
                        {
                            staticPlantList.Add((plant = SQMModelMgr.LookupPlant((decimal)partData.Used.PLANT_ID)));
                        }
                        lbl1.Text = plant.PLANT_NAME;
                        lbl2.Text = plant.DUNS_CODE;
                    }

                    lbl1 = (Label)e.Item.FindControl("lblPartUsed");
                    lbl2 = (Label)e.Item.FindControl("lblPartUsedCode");
                    if (partData.Used.CUST_PLANT_ID.HasValue)
                    {
                        if ((plant = staticPlantList.Where(l => l.PLANT_ID == partData.Used.CUST_PLANT_ID).SingleOrDefault()) == null)
                        {
                            staticPlantList.Add((plant = SQMModelMgr.LookupPlant((decimal)partData.Used.CUST_PLANT_ID)));
                        }
                        lbl1.Text = plant.PLANT_NAME;
                        lbl2.Text = plant.ADDRESS.FirstOrDefault().CITY;
                    }
                    else
                    {
                        if ((plant = staticPlantList.Where(l => l.PLANT_ID == partData.Used.PLANT_ID).SingleOrDefault()) == null)
                        {
                            staticPlantList.Add((plant = SQMModelMgr.LookupPlant((decimal)partData.Used.PLANT_ID)));
                        }
                        lbl1.Text = plant.PLANT_NAME;
                        lbl2.Text = plant.DUNS_CODE;
                    }

                    GridView gv = (GridView)e.Item.FindControl("gvProgramPartList");
                    gv.DataSource = staticPartList.Where(l => l.Used.PLANT_ID == partData.Used.PLANT_ID && l.Used.SUPP_PLANT_ID == partData.Used.SUPP_PLANT_ID && l.Used.CUST_PLANT_ID == partData.Used.CUST_PLANT_ID).ToList();
                    gv.DataBind();
                }
                catch { }
            }
        }
示例#28
0
 public BasePart(PartData data, KeelClassification classification, List <BaseAction> actions)
 {
     this.Name        = data.Name;
     this.HP          = new StatWithMax(Convert.ToInt32(Math.Round(data.MaxHP * classification.PartFactor)));
     this.Mass        = classification.PartWeight;
     this.Actions     = actions;
     this.IsDestroyed = false;
     this.Target      = null;
 }
示例#29
0
        public static ModiferDialogController Create(PartData part)
        {
            ModiferDialogController dialog = Game.Instance.UserInterface.CreateDialog <ModiferDialogController> (Game.Instance.Designer.DesignerUi.Transform, registerWithUserInterface: false);

            Game.Instance.UserInterface.BuildUserInterfaceFromResource("DesignerTools/Designer/ModiferDialog", dialog, delegate(IXmlLayoutController x) {
                dialog.OnLayoutRebuilt((XmlLayout)x.XmlLayout, part);
            });

            return(dialog);
        }
示例#30
0
    void Start()
    {
        meshRendered   = this.gameObject.GetComponent <MeshRenderer>();
        mat            = meshRendered.material;
        originalShader = mat.shader;
        originalColor  = mat.color;

        // TMP temporal
        partData = new PartData();
    }
 public void GivenAnOrderWithTheFollowingItems(Table table)
 {
     var orderlines = new List<PartData>();
     foreach (var row in table.Rows)
     {
         var line = new PartData();
         line.PartName = row["Product"];
         line.UnitPrice = row["Price"].ParseCurrency();
         line.UpfrontPercent = row["Upfront %"].ParsePercent();
         line.DiscountPercent = row["Discount %"].ParsePercent();
         line.Quantity = row["Quantity"].ParseInt();
         orderlines.Add(line);
     }
     var order = (ScenarioContext.Current.Get<PaymentData>());
     order.Parts = orderlines.ToArray();
     ScenarioContext.Current.Set(order);
 }
示例#32
0
    public static bool add(CarEngine.Part type, int status, int amount)
    {
        bool success = false;
        string key = PartData.getKey(type, status);

        PartData part = PartData.getOne(x => x.key == key);

        if (part != null) {
            part.quantity += amount;
            part.save();
            success = true;
        } else {
            PartData item = new PartData {
                part = (int)type,
                quantity = amount,
                status = status
            };
            success = item.create ();
        }
        return success;
    }
示例#33
0
        public Item_Master(PartData Part)
        {
            InitializeComponent();
            try
            {
                //Use Part to fill data fields

                Partnumber_txt.Text = Part.PartNumber;

                Description_txt.Text = Part.Description;

                type_cbo.SelectedIndex = type_cbo.Items.IndexOf(Part.PMT);

                NetWeight.Value = Part.Net_Weight;

                userevision.Checked = Part.UseRevision;

                qtybearing.Checked = Part.QtyBearing;

                phantom_chk.Checked = Part.Phantom;

                trackserial.CheckedChanged -= trackserial_CheckedChanged;

                trackserial.Checked = Part.TrackSerial;

                trackserial.CheckedChanged += trackserial_CheckedChanged;

                //NetVolume.Value = Part.Net_Vol;

                group_cbo.SelectedIndex = group_cbo.Items.IndexOf(Part.PartGroup);

                class_cbo.SelectedIndex = class_cbo.Items.IndexOf(Part.PartClass);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error importing data fields.  Default values will show.\n" + ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
        public void UpdateAeroSection(float potentialFlowNormalForce, float viscCrossflowDrag, float diameter, float flatnessRatio, float hypersonicMomentForward, float hypersonicMomentBackward,
            Vector3 centroidWorldSpace, Vector3 xRefVectorWorldSpace, Vector3 nRefVectorWorldSpace, Matrix4x4 vesselToWorldMatrix, Vector3 vehicleMainAxis, List<FARAeroPartModule> moduleList,
            List<float> dragFactor, Dictionary<Part, PartTransformInfo> partWorldToLocalMatrixDict)
        {
            mergeFactor = 0;

            this.potentialFlowNormalForce = potentialFlowNormalForce;                   //copy lifting body info over
            this.viscCrossflowDrag = viscCrossflowDrag;
            this.flatnessRatio = flatnessRatio;
            invFlatnessRatio = 1 / flatnessRatio;
            this.hypersonicMomentForward = hypersonicMomentForward;
            this.hypersonicMomentBackward = hypersonicMomentBackward;
            this.diameter = diameter;

            partData.Clear();
            handledAeroModulesIndexDict.Clear();
            if (partData.Capacity < moduleList.Capacity)
                partData.Capacity = moduleList.Capacity;

            Vector3 worldVehicleAxis = vesselToWorldMatrix.MultiplyVector(vehicleMainAxis);

            Vector3 centroidLocationAlongxRef = Vector3.Project(centroidWorldSpace, worldVehicleAxis);
            Vector3 centroidSansxRef = Vector3.ProjectOnPlane(centroidWorldSpace, worldVehicleAxis);

            Vector3 worldSpaceAvgPos = Vector3.zero;
            float totalDragFactor = 0;
            for (int i = 0; i < moduleList.Count; i++)
            {
                Part p = moduleList[i].part;
                if (partWorldToLocalMatrixDict.ContainsKey(p))
                {
                    worldSpaceAvgPos += partWorldToLocalMatrixDict[p].worldPosition * dragFactor[i];
                    totalDragFactor += dragFactor[i];
                }
            }

            worldSpaceAvgPos /= totalDragFactor;

            worldSpaceAvgPos = Vector3.ProjectOnPlane(worldSpaceAvgPos, worldVehicleAxis);

            Vector3 avgPosDiffFromCentroid = centroidSansxRef - worldSpaceAvgPos;

            for (int i = 0; i < moduleList.Count; i++)
            {
                PartData data = new PartData();
                data.aeroModule = moduleList[i];
                Matrix4x4 transformMatrix = partWorldToLocalMatrixDict[data.aeroModule.part].worldToLocalMatrix;

                Vector3 forceCenterWorldSpace = centroidLocationAlongxRef + Vector3.ProjectOnPlane(partWorldToLocalMatrixDict[data.aeroModule.part].worldPosition, worldVehicleAxis) + avgPosDiffFromCentroid;

                data.centroidPartSpace = transformMatrix.MultiplyPoint3x4(forceCenterWorldSpace);
                data.xRefVectorPartSpace = transformMatrix.MultiplyVector(xRefVectorWorldSpace);
                data.nRefVectorPartSpace = transformMatrix.MultiplyVector(nRefVectorWorldSpace);
                data.dragFactor = dragFactor[i];

                transformMatrix = transformMatrix * vesselToWorldMatrix;

                if (i < partData.Count)
                    partData[i] = data;
                else
                    partData.Add(data);

                handledAeroModulesIndexDict.Add(data.aeroModule, i);
            }

            xForcePressureAoA0.BakeCurve();
            xForcePressureAoA180.BakeCurve();
            xForceSkinFriction.BakeCurve();

            worldNormalVector = nRefVectorWorldSpace;
        }
示例#35
0
        public PartData ParseItemTemplate(string TemplateName)
        {
            PartData Pdata = new PartData();

            //ENGDataDataSetTableAdapters.TemplatesTableAdapter TableAdapter = new ENGDataDataSetTableAdapters.TemplatesTableAdapter();

            ENGDataDataSet.TemplatesDataTable DT = new ENGDataDataSet.TemplatesDataTable();

            TemplateAdapter.FillByNameType(DT, "ITEM", TemplateName);

            foreach (DataRow Dr in DT.Rows)
            {
                if (Dr["PropertyType"].ToString() == "TYPE")
                    Pdata.PMT = Dr["PropertyValue"].ToString();

                if (Dr["PropertyType"].ToString() == "UOM")
                    Pdata.Primary_UOM = Dr["PropertyValue"].ToString();

                if (Dr["PropertyType"].ToString() == "GROUP")
                    Pdata.PartGroup = Dr["PropertyValue"].ToString();

                if (Dr["PropertyType"].ToString() == "QTYBEARING")
                    try
                    {
                        Pdata.QtyBearing = bool.Parse(Dr["PropertyValue"].ToString());
                    }
                    catch { pdata.QtyBearing = false; }

                if (Dr["PropertyType"].ToString() == "CLASS")
                    Pdata.PartClass = Dr["PropertyValue"].ToString();

                if (Dr["PropertyType"].ToString() == "USEREV")
                    try
                    {
                        Pdata.UseRevision = bool.Parse(Dr["PropertyValue"].ToString());
                    }
                    catch { pdata.UseRevision = false; }

                if (Dr["PropertyType"].ToString() == "TRACKSERIAL")
                {
                    try
                    {
                        Pdata.TrackSerial = bool.Parse(Dr["PropertyValue"].ToString());
                    }
                    catch { pdata.TrackSerial = false; }

                    Pdata.TrackSerial_Mask = Dr["PropertyOptions"].ToString();
                }

                if (Dr["PropertyType"].ToString() == "PLANT")
                    Pdata.PartPlant = Dr["PropertyValue"].ToString();

                if (Dr["PropertyType"].ToString() == "WAREHOUSE")
                {
                    Pdata.PlantWhse.Add(Dr["PropertyValue"].ToString());

                    Pdata.PlantWhse_Code.Add(Dr["PropertyQty"].ToString());
                }

                if (Dr["PropertyType"].ToString() == "PLANNER")
                    Pdata.Planner = Dr["PropertyValue"].ToString();

                if (Dr["PropertyType"].ToString() == "WEIGHT_UOM")
                    Pdata.Net_Weight_UM = Dr["PropertyValue"].ToString();
            }

            return Pdata;
        }
示例#36
0
 private void PushPart(ref PartData part)
 {
     if (partStack == null) {
         partStack = new PartData[8];
         partDepth = 0;
     } else if (partStack.Length == partDepth) {
         var partDataArray = new PartData[partStack.Length*2];
         System.Array.Copy(partStack, 0, partDataArray, 0, partStack.Length);
         for (var index = 0; index < partDepth; ++index) {
             partStack[index] = new PartData();
         }
         partStack = partDataArray;
     }
     if (partDepth != 0)
         partStack[partDepth - 1] = currentPart;
     partStack[partDepth++] = part;
     currentPart = part;
 }
示例#37
0
 private void PopPart()
 {
     --partDepth;
     partStack[partDepth] = new PartData();
     currentPart = partStack[partDepth > 0 ? partDepth - 1 : 0];
 }
示例#38
0
 public void StartPart()
 {
     this.AssertOpen();
     switch (state) {
         case MimeWriteState.Complete:
         case MimeWriteState.PartContent:
             throw new System.InvalidOperationException(Resources.Strings.CannotStartPartHere);
         default:
             if (partDepth != 0) {
                 this.FlushHeader();
                 if (!currentPart.IsMultipart)
                     throw new System.InvalidOperationException(Resources.Strings.NonMultiPartPartsCannotHaveChildren);
                 if (!foundMimeVersion && forceMime && partDepth == 1)
                     this.WriteMimeVersion();
                 this.Write(MimeString.CrLf, 0, MimeString.CrLf.Length);
                 this.WriteBoundary(currentPart.Boundary, false);
             }
             var part = new PartData();
             this.PushPart(ref part);
             state = MimeWriteState.StartPart;
             contentWritten = false;
             contentTransferEncoding = ContentTransferEncoding.SevenBit;
             break;
     }
 }
示例#39
0
    void Start()
    {
        meshRendered = this.gameObject.GetComponent<MeshRenderer>();
        mat = meshRendered.material;
        originalShader = mat.shader;
        originalColor = mat.color;

        // TMP temporal
        partData = new PartData();
    }
        public FARAeroSection(FloatCurve xForcePressureAoA0, FloatCurve xForcePressureAoA180, FloatCurve xForceSkinFriction,
            float potentialFlowNormalForce, float viscCrossflowDrag, float diameter, float flatnessRatio, float hypersonicMomentForward, float hypersonicMomentBackward,
            Vector3 centroidWorldSpace, Vector3 xRefVectorWorldSpace, Vector3 nRefVectorWorldSpace, Matrix4x4 vesselToWorldMatrix, Vector3 vehicleMainAxis, List<FARAeroPartModule> moduleList,
            Dictionary<Part, FARPartGeometry.VoxelCrossSection.SideAreaValues> sideAreaValues, List<float> dragFactor, Dictionary<Part, PartTransformInfo> partWorldToLocalMatrixDict)
        {
            this.xForcePressureAoA0 = xForcePressureAoA0;       //copy references to floatcurves over
            this.xForcePressureAoA180 = xForcePressureAoA180;
            this.xForceSkinFriction = xForceSkinFriction;

            this.potentialFlowNormalForce = potentialFlowNormalForce;                   //copy lifting body info over
            this.viscCrossflowDrag = viscCrossflowDrag;
            this.flatnessRatio = flatnessRatio;
            invFlatnessRatio = 1 / flatnessRatio;
            this.hypersonicMomentForward = hypersonicMomentForward;
            this.hypersonicMomentBackward = hypersonicMomentBackward;
            this.diameter = diameter;

            partData = new List<PartData>();

            Vector3 worldVehicleAxis = vesselToWorldMatrix.MultiplyVector(vehicleMainAxis);

            Vector3 centroidLocationAlongxRef = Vector3.Project(centroidWorldSpace, worldVehicleAxis);
            Vector3 centroidSansxRef = Vector3.ProjectOnPlane(centroidWorldSpace, worldVehicleAxis);

            Vector3 worldSpaceAvgPos = Vector3.zero;
            float totalDragFactor = 0;
            for (int i = 0; i < moduleList.Count; i++)
            {
                Part p = moduleList[i].part;
                worldSpaceAvgPos += partWorldToLocalMatrixDict[p].worldPosition * dragFactor[i];
                totalDragFactor += dragFactor[i];
            }

            worldSpaceAvgPos /= totalDragFactor;

            worldSpaceAvgPos = Vector3.ProjectOnPlane(worldSpaceAvgPos, worldVehicleAxis);

            Vector3 avgPosDiffFromCentroid = centroidSansxRef - worldSpaceAvgPos;

            for (int i = 0; i < moduleList.Count; i++)
            {
                PartData data = new PartData();
                data.aeroModule = moduleList[i];
                Matrix4x4 transformMatrix = partWorldToLocalMatrixDict[data.aeroModule.part].worldToLocalMatrix;

                Vector3 forceCenterWorldSpace = centroidLocationAlongxRef + Vector3.ProjectOnPlane(partWorldToLocalMatrixDict[data.aeroModule.part].worldPosition, worldVehicleAxis) + avgPosDiffFromCentroid;

                data.centroidPartSpace = transformMatrix.MultiplyPoint3x4(forceCenterWorldSpace);
                data.xRefVectorPartSpace = transformMatrix.MultiplyVector(xRefVectorWorldSpace);
                data.nRefVectorPartSpace = transformMatrix.MultiplyVector(nRefVectorWorldSpace);
                data.dragFactor = dragFactor[i];

                FARPartGeometry.VoxelCrossSection.SideAreaValues values = sideAreaValues[data.aeroModule.part];

                transformMatrix = transformMatrix * vesselToWorldMatrix;

                /*IncrementAreas(ref data, (float)values.iP * Vector3.right, transformMatrix);
                IncrementAreas(ref data, (float)values.iN * -Vector3.right, transformMatrix);
                IncrementAreas(ref data, (float)values.jP * Vector3.up, transformMatrix);
                IncrementAreas(ref data, (float)values.jN * -Vector3.up, transformMatrix);
                IncrementAreas(ref data, (float)values.kP * Vector3.forward, transformMatrix);
                IncrementAreas(ref data, (float)values.kN * -Vector3.forward, transformMatrix);*/

                partData.Add(data);
            }

            if (crossFlowDragMachCurve == null)
                GenerateCrossFlowDragCurve();
        }