Пример #1
0
        void OnRedraw(ISelectable selectable)
        {
            if (Builder.Root.Slot.Joint != PartJoint.JointType.BD)
            {
                CartridgeHeaderRegion.gameObject.SetActive(false);
                LevelBGMask.gameObject.SetActive(false);
                CostTitleMask.gameObject.SetActive(false);
                CartridgeMask.gameObject.SetActive(false);
            }
            else
            {
                CartridgeHeaderRegion.gameObject.SetActive(true);
                LevelBGMask.gameObject.SetActive(true);
                CostTitleMask.gameObject.SetActive(true);
                CartridgeMask.gameObject.SetActive(true);
            }
            /*BD Edit Section*/
            UpdateInfoType();
            UpdateInfoHP();
            UpdateInfoSize();
            UpdateInfoCost();
            UpdateInfoCapa();
            UpdateInfoStr();
            UpdateInfoTec();
            UpdateInfoWlk();
            UpdateInfoFly();
            UpdateInfoTgh();
            UpdateInfoLevel();
            SectionFitter.Resize();

            if (selectable != null)
            {
                /*Part Edit Section*/
                //If the selectable type is a PartJointSlot
                if (selectable.GetType() == typeof(PartJointSlot))
                {
                    PartJointSlot jointSlot = (PartJointSlot)selectable;
                    PartEditSection.gameObject.SetActive(true);
                    Builder.IgnoreEvents = true;
                    //Joint
                    JointFixedBind.isOn    = jointSlot.Slot.Fixed;
                    JointRequiredBind.isOn = jointSlot.Slot.Required;
                    AllowJBind.isOn        = jointSlot.Slot.AllowJs;
                    JointTagsBind.text     = string.Join(", ", jointSlot.Slot.Tags.Values);
                    JointTypeBind.value    = (int)jointSlot.Slot.Joint;
                    //Part
                    CreatePartBind.isOn = jointSlot.Slot.EquipedPart != null ? true : false;
                    if (jointSlot.Slot.EquipedPart != null)
                    {
                        PartNameBind.text = jointSlot.Slot.EquipedPart.Name;
                        PartTagsBind.text = string.Join(", ", jointSlot.Slot.EquipedPart.Tags.Values);
                        if (jointSlot.transform == Builder.Root.transform && jointSlot.Slot.EquipedPart.Joint == PartJoint.JointType.BD)
                        {
                            PartBDTypeBind.transform.parent.gameObject.SetActive(true);
                            PartBDMaskBind.transform.parent.gameObject.SetActive(false);
                            for (int i = 0; i < 4; i++)
                            {
                                if (jointSlot.Slot.EquipedPart.BDMask.HasFlag(i))
                                {
                                    PartBDTypeBind.value = i;
                                    break;
                                }
                            }
                        }
                        else
                        {
                            PartBDMaskBind.transform.parent.gameObject.SetActive(true);
                            PartBDTypeBind.transform.parent.gameObject.SetActive(false);
                            PartBDMaskBind.Value = jointSlot.Slot.EquipedPart.BDMask;
                        }
                        PartSizeBind.value = (int)jointSlot.Slot.EquipedPart.Size;
                        PartCostBind.text  = jointSlot.Slot.EquipedPart.BaseStats.COST.ToString();
                        PartHPBind.text    = jointSlot.Slot.EquipedPart.BaseStats.HP.ToString();
                        PartSTRBind.text   = jointSlot.Slot.EquipedPart.BaseStats.STR.ToString();
                        PartTECBind.text   = jointSlot.Slot.EquipedPart.BaseStats.TEC.ToString();
                        PartWLKBind.text   = jointSlot.Slot.EquipedPart.BaseStats.WLK.ToString();
                        PartFLYBind.text   = jointSlot.Slot.EquipedPart.BaseStats.FLY.ToString();
                        PartTGHBind.text   = jointSlot.Slot.EquipedPart.BaseStats.TGH.ToString();
                        PartCAPABind.text  = jointSlot.Slot.EquipedPart.BaseStats.CAPA.ToString();
                        //Main weapon
                        MainBind.isOn = jointSlot.Slot.EquipedPart.MainWeapon != null ? true : false;
                        if (jointSlot.Slot.EquipedPart.MainWeapon != null)
                        {
                            MainForceBind.text = jointSlot.Slot.EquipedPart.MainWeapon.Force.ToString();
                            MainAmmoBind.text  = jointSlot.Slot.EquipedPart.MainWeapon.Ammo.ToString();
                            MainRangeBind.text = jointSlot.Slot.EquipedPart.MainWeapon.Range.ToString();
                            MainSpeedBind.text = jointSlot.Slot.EquipedPart.MainWeapon.Speed.ToString();
                            MainIntBind.text   = jointSlot.Slot.EquipedPart.MainWeapon.Int.ToString();
                            UpdateMainDamage();
                        }
                        //Sub weapon
                        SubBind.isOn = jointSlot.Slot.EquipedPart.SubWeapon != null ? true : false;
                        if (jointSlot.Slot.EquipedPart.SubWeapon != null)
                        {
                            SubForceBind.text = jointSlot.Slot.EquipedPart.SubWeapon.Force.ToString();
                            SubAmmoBind.text  = jointSlot.Slot.EquipedPart.SubWeapon.Ammo.ToString();
                            SubRangeBind.text = jointSlot.Slot.EquipedPart.SubWeapon.Range.ToString();
                            SubSpeedBind.text = jointSlot.Slot.EquipedPart.SubWeapon.Speed.ToString();
                            SubIntBind.text   = jointSlot.Slot.EquipedPart.SubWeapon.Int.ToString();
                            UpdateSubDamage();
                        }
                        DiscriptionBind.text = jointSlot.Slot.EquipedPart.Description;
                        IsJBind.isOn         = jointSlot.Slot.EquipedPart.IsJ;
                        SlotsBind.text       = jointSlot.Slot.EquipedPart.Tunes.Count.ToString();
                    }
                    Builder.IgnoreEvents = false;
                }
                else
                {
                    PartEditSection.gameObject.SetActive(false);
                }
            }
            else
            {
                PartEditSection.gameObject.SetActive(false);
            }
        }