75 lines
3.5 KiB
C#
75 lines
3.5 KiB
C#
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using ZGame;
|
|||
|
|
|||
|
namespace HK.FUJIFILM
|
|||
|
{
|
|||
|
public class PetIDCardModel_Fixed : Model_Fixed
|
|||
|
{
|
|||
|
protected override void ProduceDesign_CopyDesignItemAssetEvent(object sender, GameEventArgs e)
|
|||
|
{
|
|||
|
var args = e as ProduceDesign_CopyDesignItemAssetEventArgs;
|
|||
|
designItems.Clear();
|
|||
|
for (var i = 0; i < designParent.transform.childCount; i++)
|
|||
|
{
|
|||
|
GameObject.Destroy(designParent.transform.GetChild(i).gameObject);
|
|||
|
}
|
|||
|
|
|||
|
productScriptableObject = args.productScriptableObject;
|
|||
|
designParent.GetComponent<Image>().sprite = args.sprite;
|
|||
|
var instantiate = GameObject.Instantiate(args.go, designParent);
|
|||
|
if (instantiate.TryGetComponent(typeof(Image), out var image))
|
|||
|
{
|
|||
|
var component = ((Image)image);
|
|||
|
component.sprite = args.sprite;
|
|||
|
component.enabled = productScriptableObject.isShowTemplate;
|
|||
|
}
|
|||
|
|
|||
|
// only ( pet id card )
|
|||
|
var componentInChildren = args.go.GetComponentInChildren<UpdateInput>();
|
|||
|
var updateInput = instantiate.GetComponentInChildren<UpdateInput>();
|
|||
|
if (componentInChildren != null && updateInput != null)
|
|||
|
updateInput.SetData(componentInChildren.inpChinName, componentInChildren.inpEngName,
|
|||
|
componentInChildren.inpID, componentInChildren.inpID1, componentInChildren.inpID2,
|
|||
|
componentInChildren.inpBirth, componentInChildren.inpBirth1, componentInChildren.inpBirth2,
|
|||
|
componentInChildren.inpIssue, componentInChildren.inpIssue1, componentInChildren.droSex,
|
|||
|
componentInChildren.inpBianHao);
|
|||
|
|
|||
|
option = instantiate.GetComponent<RenderPrintingManagerOption>();
|
|||
|
var gridLayoutGroup = instantiate.GetComponent<GridLayoutGroup>();
|
|||
|
if (gridLayoutGroup != null)
|
|||
|
{
|
|||
|
gridLayoutGroup.constraint = option.constraint;
|
|||
|
gridLayoutGroup.constraintCount = option.constraintCount;
|
|||
|
gridLayoutGroup.spacing = option.spacing;
|
|||
|
gridLayoutGroup.padding = option.padding;
|
|||
|
gridLayoutGroup.cellSize = option.cellSize;
|
|||
|
var rectTransform = instantiate.GetComponent<RectTransform>();
|
|||
|
rectTransform.sizeDelta = designParent.sizeDelta;
|
|||
|
rectTransform.localScale = option.modelScale;
|
|||
|
rectTransform.anchoredPosition = option.modelPosition;
|
|||
|
|
|||
|
if (option.modelScale != Vector3.zero)
|
|||
|
rectTransform.localScale = option.modelScale;
|
|||
|
if (option.modelPosition != Vector2.zero)
|
|||
|
rectTransform.anchoredPosition = option.modelPosition;
|
|||
|
|
|||
|
var itemParentTrans = instantiate.transform;
|
|||
|
for (var i = 0; i < itemParentTrans.childCount; i++)
|
|||
|
{
|
|||
|
itemParentTrans.GetChild(i).GetChild(0).gameObject.SetActive(true);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
instantiate.transform.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
|
|||
|
var list = instantiate.transform.FindChildDeeps<ImageDesignItem>();
|
|||
|
|
|||
|
foreach (var imageDesignItem in list)
|
|||
|
{
|
|||
|
imageDesignItem.IsHideBtnAdd(true);
|
|||
|
designItems.Add(imageDesignItem.ID, imageDesignItem);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|