Beispiel #1
0
            private static bool ChaControl_ChangeAccessoryParent_Prefix(ChaControl __instance, int slotNo, string parentStr, ref bool __result)
            {
                if (slotNo >= __instance.objAccessory.Length)
                {
                    __result = false;
                    return(false);
                }

                GameObject gameObject = __instance.objAccessory[slotNo];

                if (gameObject == null)
                {
                    __result = false;
                    return(false);
                }
                if (parentStr == "none")
                {
                    gameObject.transform.SetParent(null, worldPositionStays: false);
                    __result = true;
                    return(false);
                }
                ListInfoBase listInfoBase = __instance.infoAccessory[slotNo];

                if (listInfoBase != null)
                {
                    listInfoBase = gameObject.GetComponent <ListInfoComponent>().data;
                }
                if (listInfoBase.GetInfo(ChaListDefine.KeyType.Parent) == "0")
                {
                    __result = false;
                    return(false);
                }
                try
                {
                    /*
                     * ChaReference.RefObjKey key = (ChaReference.RefObjKey) Enum.Parse(typeof(ChaReference.RefObjKey), parentStr);
                     * GameObject referenceInfo = __instance.GetReferenceInfo(key);
                     */
                    GameObject referenceInfo = __instance.GetComponentsInChildren <Transform>(true).FirstOrDefault(x => x.name == parentStr)?.gameObject;
                    if (referenceInfo == null)
                    {
                        __result = false;
                        return(false);
                    }
                    gameObject.transform.SetParent(referenceInfo.transform, worldPositionStays: false);
                    __instance.nowCoordinate.accessory.parts[slotNo].parentKey   = parentStr;
                    __instance.nowCoordinate.accessory.parts[slotNo].partsOfHead = ChaAccessoryDefine.CheckPartsOfHead(parentStr);
                }
                catch (ArgumentException)
                {
                    __result = false;
                    return(false);
                }
                __result = true;
                return(false);
            }
 private void CopyAccessory()
 {
     this.nowAcs.parts[this.selDst] = (ChaFileAccessory.PartsInfo)MessagePackSerializer.Deserialize <ChaFileAccessory.PartsInfo>(MessagePackSerializer.Serialize <ChaFileAccessory.PartsInfo>((M0)this.nowAcs.parts[this.selSrc]));
     if (this.tglChgParentLR.get_isOn())
     {
         string reverseParent = ChaAccessoryDefine.GetReverseParent(this.nowAcs.parts[this.selDst].parentKey);
         if (string.Empty != reverseParent)
         {
             this.nowAcs.parts[this.selDst].parentKey = reverseParent;
         }
     }
     this.chaCtrl.AssignCoordinate();
     Singleton <Character> .Instance.customLoadGCClear = false;
     this.chaCtrl.Reload(false, true, true, true, true);
     Singleton <Character> .Instance.customLoadGCClear = true;
     this.CalculateUI();
     this.customBase.ChangeAcsSlotName(-1);
     this.customBase.forceUpdateAcsList = true;
     this.customBase.updateCvsAccessory = true;
 }
        public override void UpdateCustomUI()
        {
            if (this.backSNo != this.SNo)
            {
                this.UpdateAcsList(-1);
                for (int _correctNo = 0; _correctNo < this.acCorrect.Length; ++_correctNo)
                {
                    this.acCorrect[_correctNo].Initialize(this.SNo, _correctNo);
                }
                this.backSNo = this.SNo;
            }
            else if (this.customBase.forceUpdateAcsList)
            {
                this.UpdateAcsList(-1);
                this.customBase.forceUpdateAcsList = false;
            }
            this.customBase.showAcsControllerAll = this.customBase.chaCtrl.IsAccessory(this.SNo);
            if (!this.mainMenu.IsSelectAccessory())
            {
                this.customBase.showAcsControllerAll = false;
            }
            base.UpdateCustomUI();
            this.CalculateUI();
            int num1 = this.nowAcs.parts[this.SNo].type - 350;

            for (int index = 0; index < this.tglType.Length; ++index)
            {
                this.tglType[index].SetIsOnWithoutCallback(num1 == index);
            }
            CmpAccessory cmpAccessory = this.chaCtrl.cmpAccessory[this.SNo];
            bool         flag         = false;

            if (Object.op_Inequality((Object)null, (Object)cmpAccessory))
            {
                flag = cmpAccessory.typeHair;
            }
            if (flag)
            {
                this.csHairBaseColor.SetColor(this.nowAcs.parts[this.SNo].colorInfo[0].color);
                this.csHairTopColor.SetColor(this.nowAcs.parts[this.SNo].colorInfo[1].color);
                this.csHairUnderColor.SetColor(this.nowAcs.parts[this.SNo].colorInfo[2].color);
                this.csHairSpecular.SetColor(this.nowAcs.parts[this.SNo].colorInfo[3].color);
            }
            else
            {
                for (int index = 0; index < this.csColor.Length; ++index)
                {
                    this.csColor[index].SetColor(this.nowAcs.parts[this.SNo].colorInfo[index].color);
                }
            }
            this.sscAcs.SetToggleID(this.nowAcs.parts[this.SNo].id);
            int num2 = ChaAccessoryDefine.GetAccessoryParentInt(this.nowAcs.parts[this.SNo].parentKey) - 1;

            if (0 <= num2)
            {
                for (int index = 0; index < this.tglParent.Length; ++index)
                {
                    this.tglParent[index].SetIsOnWithoutCallback(num2 == index);
                }
            }
            this.tglNoShake.SetIsOnWithoutCallback(this.nowAcs.parts[this.SNo].noShake);
            bool[] flagArray = new bool[2];
            if (Object.op_Inequality((Object)null, (Object)this.chaCtrl.cmpAccessory[this.SNo]))
            {
                if (Object.op_Inequality((Object)null, (Object)this.chaCtrl.cmpAccessory[this.SNo].trfMove01))
                {
                    flagArray[0] = true;
                }
                if (Object.op_Inequality((Object)null, (Object)this.chaCtrl.cmpAccessory[this.SNo].trfMove02))
                {
                    flagArray[1] = true;
                }
            }
            for (int index = 0; index < this.acCorrect.Length; ++index)
            {
                ((Component)this.acCorrect[index]).get_gameObject().SetActiveIfDifferent(flagArray[index]);
                this.acCorrect[index].UpdateCustomUI();
                this.customBase.showAcsController[index] = flagArray[index];
            }
            this.RestrictAcsMenu();
            if (!Object.op_Inequality((Object)null, (Object)this.titleText))
            {
                return;
            }
            this.titleText.set_text(string.Format("{0:00} {1}", (object)(this.SNo + 1), (object)this.chaCtrl.lstCtrl.GetListInfo((ChaListDefine.CategoryNo) this.nowAcs.parts[this.SNo].type, this.nowAcs.parts[this.SNo].id).Name));
        }