64 lines
2.4 KiB
C#
64 lines
2.4 KiB
C#
|
using System.Collections.Generic;
|
|||
|
using UnityEngine;
|
|||
|
using UnityEngine.UI;
|
|||
|
using ZGame;
|
|||
|
|
|||
|
namespace HK.FUJIFILM
|
|||
|
{
|
|||
|
public class DoubleSideCushion_Fixed : Model_Fixed
|
|||
|
{
|
|||
|
public Vector2 spacing = new Vector2(180, 50);
|
|||
|
|
|||
|
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;
|
|||
|
}
|
|||
|
|
|||
|
if (instantiate.TryGetComponent(typeof(GridLayoutGroup), out var grid))
|
|||
|
{
|
|||
|
(grid as GridLayoutGroup).spacing = new Vector2(spacing.x, spacing.y);
|
|||
|
}
|
|||
|
|
|||
|
var binding = instantiate.transform.GetChild(0).GetComponent<UIGameObjectBinding>();
|
|||
|
var allValue = binding.GetAllValue();
|
|||
|
foreach (var go in allValue)
|
|||
|
{
|
|||
|
if (go.name == "Image")
|
|||
|
continue;
|
|||
|
go.transform.GetChild(0).gameObject.SetActive(true);
|
|||
|
}
|
|||
|
|
|||
|
var binding1 = instantiate.transform.GetChild(1).GetComponent<UIGameObjectBinding>();
|
|||
|
var allValue1 = binding1.GetAllValue();
|
|||
|
foreach (var go in allValue1)
|
|||
|
{
|
|||
|
if (go.name == "Image")
|
|||
|
continue;
|
|||
|
go.transform.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);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|