首次提交

This commit is contained in:
Bob.Song
2026-03-05 18:07:55 +08:00
commit e125bb869e
4534 changed files with 563920 additions and 0 deletions

View File

@@ -0,0 +1,73 @@
using FairyGUI;
public class Card : GButton
{
GObject _back;
GObject _front;
public override void ConstructFromXML(FairyGUI.Utils.XML xml)
{
base.ConstructFromXML(xml);
_back = GetChild("n0");
_front = GetChild("icon");
_front.visible = false;
}
public bool opened
{
get
{
return _front.visible;
}
set
{
GTween.Kill(this);
_front.visible = value;
_back.visible = !value;
}
}
public void SetPerspective()
{
_front.displayObject.perspective = true;
_back.displayObject.perspective = true;
}
public void Turn()
{
if (GTween.IsTweening(this))
return;
bool toOpen = !_front.visible;
GTween.To(0, 180, 0.8f).SetTarget(this).SetEase(EaseType.QuadOut).OnUpdate(TurnInTween).SetUserData(toOpen);
}
void TurnInTween(GTweener tweener)
{
bool toOpen = (bool)tweener.userData;
float v = tweener.value.x;
if (toOpen)
{
_back.rotationY = v;
_front.rotationY = -180 + v;
if (v > 90)
{
_front.visible = true;
_back.visible = false;
}
}
else
{
_back.rotationY = -180 + v;
_front.rotationY = v;
if (v > 90)
{
_front.visible = false;
_back.visible = true;
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f508880d965b60742b34521caee31d63
timeCreated: 1465454889
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,45 @@
using UnityEngine;
using FairyGUI;
public class TurnCardMain : MonoBehaviour
{
GComponent _mainView;
Card _c0;
Card _c1;
void Awake()
{
Application.targetFrameRate = 60;
Stage.inst.onKeyDown.Add(OnKeyDown);
UIPackage.AddPackage("UI/TurnCard");
UIObjectFactory.SetPackageItemExtension("ui://TurnCard/CardComponent", typeof(Card));
}
void Start()
{
_mainView = this.GetComponent<UIPanel>().ui;
_c0 = (Card)_mainView.GetChild("c0");
_c1 = (Card)_mainView.GetChild("c1");
_c1.SetPerspective();
_c0.onClick.Add(__clickCard);
_c1.onClick.Add(__clickCard);
}
void __clickCard(EventContext context)
{
Card card = (Card)context.sender;
card.Turn();
}
void OnKeyDown(EventContext context)
{
if (context.inputEvent.keyCode == KeyCode.Escape)
{
Application.Quit();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f30e9532e25d54e4789a3b737b33f79e
timeCreated: 1465453409
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: