Commit 6f2a7aa4 authored by 神楽坂玲奈's avatar 神楽坂玲奈

code reformat

parent 5771b093
using UnityEngine;
using System.Collections;
public class ContinuesButton : MonoBehaviour {
UIButton btn;
// Use this for initialization
void Start ()
public class ContinuesButton : MonoBehaviour
{
private UIButton btn;
private bool isTrigging;
// Update is called once per frame
private float time;
// Use this for initialization
private void Start()
{
btn = GetComponentInChildren<UIButton>();
UIEventTrigger trigger= gameObject.GetComponentInChildren<UIEventTrigger>();
if (trigger==null)
{
trigger = gameObject.AddComponent<UIEventTrigger>();
}
var trigger = gameObject.GetComponentInChildren<UIEventTrigger>();
if (trigger == null) trigger = gameObject.AddComponent<UIEventTrigger>();
trigger.onRelease.Add(new EventDelegate(this, "off"));
trigger.onPress.Add(new EventDelegate(this, "on"));
}
void on()
{
isTrigging = true;
time = 0;
}
void off()
private void Update()
{
isTrigging = false;
time = 0;
}
bool isTrigging = false;
// Update is called once per frame
float time = 0;
void Update () {
if (isTrigging)
{
if (btn!=null)
if (isTrigging)
if (btn != null)
{
time += Time.deltaTime;
if (time > 0.2f)
......@@ -43,6 +31,17 @@ public class ContinuesButton : MonoBehaviour {
EventDelegate.Execute(btn.onClick);
}
}
}
}
}
private void on()
{
isTrigging = true;
time = 0;
}
private void off()
{
isTrigging = false;
time = 0;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class MONO_wait : MonoBehaviour {
public class MONO_wait : MonoBehaviour
{
public UILabel lab;
string s = "";
// Use this for initialization
void Start ()
private float a;
private string s = "";
// Use this for initialization
private void Start()
{
s = InterString.Get("等待对方行动中");
}
float a = 0;
// Update is called once per frame
void Update () {
}
// Update is called once per frame
private void Update()
{
a += Time.deltaTime;
string t = "";
for (int i = 0; i < (((int)(a * 60)) / 20) % 4; i++)
{
t += InterString.Get("…");
}
var t = "";
for (var i = 0; i < (int) (a * 60) / 20 % 4; i++) t += InterString.Get("…");
lab.text = t + s + t;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class lazyBTNMOVER : MonoBehaviour {
public class lazyBTNMOVER : MonoBehaviour
{
public UILabel g1;
public UILabel g2;
public UILabel g3;
......@@ -47,4 +46,4 @@ public class lazyBTNMOVER : MonoBehaviour {
g5.text = "MP2";
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
public class phaser : MonoBehaviour {
public Action mp2Action;
public Action bpAction;
public Action epAction;
using System;
using UnityEngine;
public class phaser : MonoBehaviour
{
public BoxCollider colliderMp2;
public BoxCollider colliderBp;
public BoxCollider colliderEp;
public UILabel labDp;
public UILabel labSp;
public UILabel labMp1;
public UILabel labMp1;
public UILabel labBp;
public UILabel labMp2;
public UILabel labEp;
public UILabel labEp;
public Action bpAction;
public Action epAction;
public Action mp2Action;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
private void Start()
{
}
// Update is called once per frame
private void Update()
{
if (Program.InputGetMouseButtonUp_0)
{
if (Program.pointedCollider== colliderMp2)
{
if (mp2Action!=null)
{
if (Program.pointedCollider == colliderMp2)
if (mp2Action != null)
mp2Action();
}
}
if (Program.pointedCollider == colliderBp)
{
if (bpAction != null)
{
bpAction();
}
}
if (Program.pointedCollider == colliderEp)
{
if (epAction != null)
{
epAction();
}
}
}
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class pngSord : MonoBehaviour {
// Use this for initialization
void Start () {
public class pngSord : MonoBehaviour
{
// Use this for initialization
private void Start()
{
gameObject.GetComponent<Renderer>().material.mainTexture = GameTextureManager.attack;
gameObject.transform.localScale = new Vector3(1, 1f / (float)GameTextureManager.attack.width * (float)GameTextureManager.attack.height, 1);
gameObject.transform.localScale =
new Vector3(1, 1f / GameTextureManager.attack.width * GameTextureManager.attack.height, 1);
}
// Update is called once per frame
void Update () {
}
}
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System;
using UnityEngine;
using YGOSharp;
public class OpenCardOnClick : MonoBehaviour
{
void OnClick()
private void OnClick()
{
UILabel lbl = GetComponent<UILabel>();
var lbl = GetComponent<UILabel>();
if (lbl != null)
{
try
{
string s = lbl.GetUrlAtPosition(UICamera.lastWorldPosition);
if (string.IsNullOrEmpty(s))
{
return;
}
int code = int.Parse(s);
((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true);
var s = lbl.GetUrlAtPosition(UICamera.lastWorldPosition);
if (string.IsNullOrEmpty(s)) return;
var code = int.Parse(s);
Program.I().cardDescription.setData(CardsManager.Get(code), GameTextureManager.myBack, "", true);
}
catch (System.Exception e)
catch (Exception e)
{
Debug.Log(e);
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class smartSelection : MonoBehaviour {
public class smartSelection : MonoBehaviour
{
public UILabel name_lable;
public UITexture under_;
......@@ -10,24 +10,24 @@ public class smartSelection : MonoBehaviour {
public GameObject obj;
public void setName(string s)
public void setName(string s)
{
name_lable.text = s;
}
public void setSelected(bool s)
public void setSelected(bool s)
{
under_.color = s ? Color.white : (new Color(0, 0, 0, 0));
under_.color = s ? Color.white : new Color(0, 0, 0, 0);
}
public string getNmae()
public string getNmae()
{
return name_lable.text;
}
public void set_width(int width)
public void set_width(int width)
{
int w = width + 80;
var w = width + 80;
under_.width = w;
collider.size = new Vector3(w, under_.height + 5, 1);
collider.center = new Vector3(0, -2.5f, 0);
......@@ -36,10 +36,7 @@ public class smartSelection : MonoBehaviour {
public static void IselectedSetter(GameObject obj, bool selected)
{
smartSelection smartSelection = obj.GetComponent<smartSelection>();
if (smartSelection != null)
{
smartSelection.setSelected(selected);
}
var smartSelection = obj.GetComponent<smartSelection>();
if (smartSelection != null) smartSelection.setSelected(selected);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class LAZYsetting : MonoBehaviour {
public class LAZYsetting : MonoBehaviour
{
public UISlider sliderVolum;
public UISlider sliderSizeDrawing;
public UISlider sliderSize;
......@@ -12,7 +12,7 @@ public class LAZYsetting : MonoBehaviour {
public UIToggle closeUp;
public UIToggle showoff;
public UIToggle showoffWhenActived;
public UIToggle cloud;
public UIToggle cloud;
public UIToggle Vbattle;
public UIToggle Vmove;
public UIToggle Vchain;
......@@ -42,12 +42,12 @@ public class LAZYsetting : MonoBehaviour {
public UIToggle spyer;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class YGO1superShower : MonoBehaviour {
public class YGO1superShower : MonoBehaviour
{
public UITexture card;
public UITexture closeup;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class pro1CardShower : MonoBehaviour {
public class pro1CardShower : MonoBehaviour
{
public UITexture card;
public UITexture mask;
public UITexture disable;
......@@ -19,4 +19,4 @@ public class pro1CardShower : MonoBehaviour {
t.duration = 0.7f;
t.enabled = true;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class rotatotr : MonoBehaviour {
// Use this for initialization
void Start () {
}
public class rotatotr : MonoBehaviour
{
// Use this for initialization
private void Start()
{
}
// Update is called once per frame
void Update()
private void Update()
{
transform.Rotate(Vector3.forward * Time.deltaTime * 80);
}
}
}
\ No newline at end of file

using UnityEngine;
using System.Collections;
using UnityEngine;
public class AnimUnit : MonoBehaviour
{
public float m_fspeed = 1;
private MegaWorldPathDeform m_kMWPD = null;
private MegaShapeArc m_kShapeArc = null;
private float m_fAccumAnimOffset = 0.0f;
private float m_fArrowHeadLenth = 0.57f;
//private float m_fRGB = 1/255.0f;
private float m_fHigh = 1.0f; //画线高度定值 --CardGame
void Start()
{
m_kMWPD = GetComponent<MegaWorldPathDeform> ();
m_fAccumAnimOffset = m_kMWPD.Offset.z;
//Debug.Log ("offset val is " + m_kAccumAnimOffset + " when init");
// this.gameObject.renderer.material =
// new Material(Shader.Find("Custom/CardSeriesShader"));
// this.gameObject.renderer.material.mainTexture=(Texture)Resources.Load("Texture/arrow");
//Color color = new Color(141* m_fRGB, m_fRGB, m_fRGB);
//this.gameObject.renderer.material.SetColor("_BlendColor",color);
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0);
}
void Update()
{
public float m_fspeed = 1;
private float m_fAccumAnimOffset;
private readonly float m_fArrowHeadLenth = 0.57f;
//private float m_fRGB = 1/255.0f;
private readonly float m_fHigh = 1.0f; //画线高度定值 --CardGame
private MegaWorldPathDeform m_kMWPD;
private MegaShapeArc m_kShapeArc;
private void Start()
{
m_kMWPD = GetComponent<MegaWorldPathDeform>();
m_fAccumAnimOffset = m_kMWPD.Offset.z;
//Debug.Log ("offset val is " + m_kAccumAnimOffset + " when init");
// this.gameObject.renderer.material =
// new Material(Shader.Find("Custom/CardSeriesShader"));
// this.gameObject.renderer.material.mainTexture=(Texture)Resources.Load("Texture/arrow");
//Color color = new Color(141* m_fRGB, m_fRGB, m_fRGB);
//this.gameObject.renderer.material.SetColor("_BlendColor",color);
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
}
private void Update()
{
// float fnowoffset = m_kShapeArc.GetCurveLength (0) - m_fAccumAnimOffset;
//
// float linelenth = (m_kShapeArc.GetCurveLength (0) - (m_fArrowHeadLenth*0.04f)/2 + 0.764f)/5;
......@@ -53,37 +51,23 @@ public class AnimUnit : MonoBehaviour
// {
// this.gameObject.renderer.material.SetFloat("_Alpha",0);
// }
}
// void AlphaSet()
// {
// m_kShapeArc.GetCurveLength (0);
// }
}
public void SetAllAlphaZero()
{
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0);
}
private void FixedUpdate()
{
if (m_kShapeArc == null) return;
void FixedUpdate()
{
if (m_kShapeArc == null)
{
return;
}
m_fAccumAnimOffset += -m_fspeed * Time.deltaTime;
//if (m_fAccumAnimOffset >= m_kShapeArc.GetCurveLength (0)-(m_fArrowHeadLenth*0.02f)/2 - 0.382f)
if (m_fAccumAnimOffset <= m_fArrowHeadLenth * 0.04f / 2 + 0.764f)
{
//m_fAccumAnimOffset = 0.0f;
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
m_kShapeArc.GetComponent<LoopPathAnim>().moveToTail(m_kMWPD);
}
m_fAccumAnimOffset += -m_fspeed * Time.deltaTime;
//if (m_fAccumAnimOffset >= m_kShapeArc.GetCurveLength (0)-(m_fArrowHeadLenth*0.02f)/2 - 0.382f)
if (m_fAccumAnimOffset <= (m_fArrowHeadLenth*0.04f)/2 + 0.764f)
{
//m_fAccumAnimOffset = 0.0f;
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0);
m_kShapeArc.GetComponent<LoopPathAnim>().moveToTail(m_kMWPD);
}
m_kMWPD.Offset.z = m_fAccumAnimOffset;
m_kMWPD.Offset.z = m_fAccumAnimOffset;
// float linelenth = (m_kShapeArc.GetCurveLength (0) - (m_fArrowHeadLenth*0.04f)/2 + 0.764f)/5;
// float lineMax = m_kShapeArc.GetCurveLength (0);
......@@ -105,38 +89,37 @@ public class AnimUnit : MonoBehaviour
// }
float fnowoffset = m_kShapeArc.GetCurveLength (0) - m_fAccumAnimOffset;
var fnowoffset = m_kShapeArc.GetCurveLength(0) - m_fAccumAnimOffset;
float linelenth = (m_fArrowHeadLenth*0.04f)/2 + 0.764f;
var linelenth = m_fArrowHeadLenth * 0.04f / 2 + 0.764f;
if(fnowoffset>0&&fnowoffset<= m_fHigh)
{
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",fnowoffset/m_fHigh);
}
else if(fnowoffset>m_fHigh && fnowoffset<=m_kShapeArc.GetCurveLength (0) - m_fHigh - linelenth)
{
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0.7f);
}
else if(fnowoffset>m_kShapeArc.GetCurveLength (0) - m_fHigh - linelenth && fnowoffset<=m_kShapeArc.GetCurveLength (0))
{
float f = (1 - ((fnowoffset - m_kShapeArc.GetCurveLength(0) + m_fHigh + linelenth) / m_fHigh)) * 0.7f;
if (fnowoffset > 0 && fnowoffset <= m_fHigh)
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", fnowoffset / m_fHigh);
}
else if (fnowoffset > m_fHigh && fnowoffset <= m_kShapeArc.GetCurveLength(0) - m_fHigh - linelenth)
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0.7f);
}
else if (fnowoffset > m_kShapeArc.GetCurveLength(0) - m_fHigh - linelenth &&
fnowoffset <= m_kShapeArc.GetCurveLength(0))
{
var f = (1 - (fnowoffset - m_kShapeArc.GetCurveLength(0) + m_fHigh + linelenth) / m_fHigh) * 0.7f;
//if (f > 0.05f)
//{
// f = 1;
//}
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",f);
}
else
{
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0);
}
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", f);
}
else
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
}
//float linelenth = m_kShapeArc.GetCurveLength (0)/5;
//设置alpha
//float linelenth = m_kShapeArc.GetCurveLength (0)/5;
//设置alpha
// if(fnowoffset>0&&fnowoffset<= linelenth)
// {
// this.gameObject.renderer.material.SetFloat("_Alpha",fnowoffset/linelenth);
......@@ -153,21 +136,31 @@ public class AnimUnit : MonoBehaviour
// {
// this.gameObject.renderer.material.SetFloat("_Alpha",0);
// }
}
public void setMegaShape(MegaShapeArc msa)
{
m_kShapeArc = msa;
}
public float getAccumOffset()
{
return m_fAccumAnimOffset;
}
public void setAccumOffset(float val)
{
m_fAccumAnimOffset = val;
}
}
}
// void AlphaSet()
// {
// m_kShapeArc.GetCurveLength (0);
// }
public void SetAllAlphaZero()
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
}
public void setMegaShape(MegaShapeArc msa)
{
m_kShapeArc = msa;
}
public float getAccumOffset()
{
return m_fAccumAnimOffset;
}
public void setAccumOffset(float val)
{
m_fAccumAnimOffset = val;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class LoopMegaCtrl : MonoBehaviour {
// Use this for initialization
private float m_offsetZ;
private float m_offsetpercent;
private float m_pathLenth;
public GameObject Path = null;
float m_ObjectLenth;
float m_fBeforeLenth = 0.0f;
public int m_iID;
public GameObject m_kFirstOb = null;
bool m_bneedtoFollow = true;
public int m_iCount = 0;
void Start () {
//物体长度 --CardGame
m_ObjectLenth = 0.9f*0.02f;
//this.GetComponent<MegaWorldPathDeform>().animate = false;
//this.GetComponent<MegaWorldPathDeform>().percent = 0;
}
// Update is called once per frame
void Update () {
}
void LateUpdate()
{
LoopMegaAntmation();
}
void LoopMegaAntmation()
{
//if(m_offsetZ>0)
//{
//获得线段长度 --CardGame
if(m_bneedtoFollow && m_kFirstOb!=null )
{
this.GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = false;
}
public class LoopMegaCtrl : MonoBehaviour
{
public GameObject Path;
public int m_iID;
public GameObject m_kFirstOb;
public int m_iCount;
private bool m_bneedtoFollow = true;
private float m_fBeforeLenth;
private float m_ObjectLenth;
private float m_offsetpercent;
// Use this for initialization
private float m_offsetZ;
private float m_pathLenth;
private void Start()
{
//物体长度 --CardGame
m_ObjectLenth = 0.9f * 0.02f;
//this.GetComponent<MegaWorldPathDeform>().animate = false;
//this.GetComponent<MegaWorldPathDeform>().percent = 0;
}
// Update is called once per frame
private void Update()
{
}
private void LateUpdate()
{
LoopMegaAntmation();
}
private void LoopMegaAntmation()
{
//if(m_offsetZ>0)
//{
//获得线段长度 --CardGame
if (m_bneedtoFollow && m_kFirstOb != null)
{
GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = false;
}
// if(m_iCount>=5)
// {
......@@ -51,8 +51,7 @@ public class LoopMegaCtrl : MonoBehaviour {
// }
m_pathLenth=Path.GetComponent<MegaShapeArc>().GetCurveLength(0);
m_pathLenth = Path.GetComponent<MegaShapeArc>().GetCurveLength(0);
// if(m_fBeforeLenth>m_pathLenth)
// {
......@@ -70,37 +69,31 @@ public class LoopMegaCtrl : MonoBehaviour {
// {
// this.GetComponent<MegaWorldPathDeform>().animate = true;
// }
m_fBeforeLenth = m_pathLenth;
m_offsetZ = -this.GetComponent<MegaWorldPathDeform>().Offset.z;
m_offsetpercent = ((m_ObjectLenth + m_offsetZ)/m_pathLenth)*100;
//Debug.Log(this.name+":" + m_offsetpercent);
this.GetComponent<MegaWorldPathDeform>().path = Path.GetComponent<MegaShapeArc>();
if(this.GetComponent<MegaWorldPathDeform>().percent >= 100+m_offsetpercent)
{
//调整位置方法 --CardGame
if(m_kFirstOb!=null)
{
Debug.Log ("else follow first");
this.GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = true;
}
else
{
Debug.Log ("first to 0");
this.GetComponent<MegaWorldPathDeform>().percent = 0;
}
}
}
}
m_fBeforeLenth = m_pathLenth;
m_offsetZ = -GetComponent<MegaWorldPathDeform>().Offset.z;
m_offsetpercent = (m_ObjectLenth + m_offsetZ) / m_pathLenth * 100;
//Debug.Log(this.name+":" + m_offsetpercent);
GetComponent<MegaWorldPathDeform>().path = Path.GetComponent<MegaShapeArc>();
if (GetComponent<MegaWorldPathDeform>().percent >= 100 + m_offsetpercent)
{
//调整位置方法 --CardGame
if (m_kFirstOb != null)
{
Debug.Log("else follow first");
GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = true;
}
else
{
Debug.Log("first to 0");
GetComponent<MegaWorldPathDeform>().percent = 0;
}
}
}
}
\ No newline at end of file

using System.Collections.Generic;
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class LoopPathAnim : MonoBehaviour
public class LoopPathAnim : MonoBehaviour
{
public List<MegaWorldPathDeform> m_kMWPD_List =
new List<MegaWorldPathDeform>();
public float m_fOffsetValueStep = 1.0f;
// public GameObject m_kStartObject = null;
// public GameObject m_kEndObject = null;
private MegaShapeArc m_kShapeArc = null;
public List<MegaWorldPathDeform> m_kMWPD_List =
new List<MegaWorldPathDeform>();
public float m_fOffsetValueStep = 1.0f;
private MegaShapeArc m_kShapeArc;
void Start ()
{
m_kShapeArc = GetComponent<MegaShapeArc> ();
private void Start()
{
m_kShapeArc = GetComponent<MegaShapeArc>();
// m_kStartObject.transform.position = m_kShapeArc.splines [0].knots [0].p;
// m_kEndObject.transform.position =
// m_kShapeArc.splines [0].knots[ m_kShapeArc.splines [0].knots.Count-1 ].p;
foreach(MegaWorldPathDeform iter in m_kMWPD_List)
{
if( iter.GetComponent<AnimUnit>() )
{
iter.GetComponent<AnimUnit>().setMegaShape(m_kShapeArc);
//Debug.Log("set shaps...");
}
}
}
foreach (var iter in m_kMWPD_List)
if (iter.GetComponent<AnimUnit>())
iter.GetComponent<AnimUnit>().setMegaShape(m_kShapeArc);
//Debug.Log("set shaps...");
}
void Update ()
{
}
private void Update()
{
}
void LateUpdate()
{
private void LateUpdate()
{
// m_kShapeArc.splines [0].knots [0].p = m_kStartObject.transform.position;
//
// m_kShapeArc.splines [0].knots [m_kShapeArc.splines [0].knots.Count - 1].p =
// m_kEndObject.transform.position;
}
//得到曲线路径长度 --CardGame
public float getShapeLen()
{
return m_kShapeArc.GetCurveLength(0);
}
//添加到箭头组成尾部 --CardGame
public void moveToTail(MegaWorldPathDeform mwpd)
{
if( m_kMWPD_List.Contains(mwpd) )
{
float val =
m_kMWPD_List[m_kMWPD_List.Count-1].
GetComponent<AnimUnit>().getAccumOffset() + m_fOffsetValueStep;
mwpd.GetComponent<AnimUnit>().setAccumOffset(val);
m_kMWPD_List.Remove(mwpd);
m_kMWPD_List.Add(mwpd);
}
}
}
}
//得到曲线路径长度 --CardGame
public float getShapeLen()
{
return m_kShapeArc.GetCurveLength(0);
}
//添加到箭头组成尾部 --CardGame
public void moveToTail(MegaWorldPathDeform mwpd)
{
if (m_kMWPD_List.Contains(mwpd))
{
var val =
m_kMWPD_List[m_kMWPD_List.Count - 1].GetComponent<AnimUnit>().getAccumOffset() + m_fOffsetValueStep;
mwpd.GetComponent<AnimUnit>().setAccumOffset(val);
m_kMWPD_List.Remove(mwpd);
m_kMWPD_List.Add(mwpd);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class RendMega : MonoBehaviour {
public class RendMega : MonoBehaviour
{
public Vector3 StartPosition = Vector3.zero;
public Vector3 FingerPosition = Vector3.zero;
public Transform SkillPosition;
public Transform SkillPositionForm;
public GameObject m_kPath;
public Vector3 StartPosition = Vector3.zero;
public Vector3 FingerPosition = Vector3.zero;
public Transform SkillPosition = null;
public Transform SkillPositionForm = null;
public GameObject m_kPath = null;
public float k = 3f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update()
{
MyRenderPath();
// Use this for initialization
private void Start()
{
}
}
// Update is called once per frame
private void Update()
{
MyRenderPath();
}
public void MyRenderPath()
{
public void MyRenderPath()
{
m_kPath.transform.localScale = new Vector3(k, k, k);
Vector3 v3FromPos = SkillPosition.position/k;
Vector3 v3TargetPos = SkillPositionForm.position/k;
Vector3 v3MidPos = (v3FromPos + v3TargetPos)/2;
var v3FromPos = SkillPosition.position / k;
var v3TargetPos = SkillPositionForm.position / k;
var v3MidPos = (v3FromPos + v3TargetPos) / 2;
v3MidPos += new Vector3(0, Vector3.Distance(v3TargetPos, v3FromPos) / 10f * 3f, 0);
v3MidPos += (v3TargetPos - v3FromPos) / 10f * 3f;
Vector3 V3Midvect = (v3TargetPos - v3FromPos)/4;
var V3Midvect = (v3TargetPos - v3FromPos) / 4;
Vector3 v3FromAnchorIn = v3FromPos+new Vector3(0,-(v3MidPos.y/3),0) ;
var v3FromAnchorIn = v3FromPos + new Vector3(0, -(v3MidPos.y / 3), 0);
//Vector3 v3FromAnchorOut = v3FromPos+new Vector3(0,(v3MidPos.y/3),0) ;
Vector3 v3FromAnchorOut = v3FromPos + V3Midvect;
var v3FromAnchorOut = v3FromPos + V3Midvect;
//Vector3 v3TarGetAnchorIn = v3TargetPos +new Vector3(0,(v3MidPos.y/3),0) ;
Vector3 v3TarGetAnchorIn = v3TargetPos + new Vector3(0, (v3MidPos.y / 3), 0) - V3Midvect/10;
Vector3 v3TarGetAnchorOut = v3TargetPos + new Vector3(0, -(v3MidPos.y / 3), 0);
var v3TarGetAnchorIn = v3TargetPos + new Vector3(0, v3MidPos.y / 3, 0) - V3Midvect / 10;
var v3TarGetAnchorOut = v3TargetPos + new Vector3(0, -(v3MidPos.y / 3), 0);
Vector3 v3MidAnchorIn = v3MidPos - V3Midvect;
Vector3 v3MidAnchorOut = v3MidPos + V3Midvect ;
var v3MidAnchorIn = v3MidPos - V3Midvect;
var v3MidAnchorOut = v3MidPos + V3Midvect;
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0,0,v3FromPos,v3FromAnchorIn,v3FromAnchorOut);
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0,1,v3MidPos,v3MidAnchorIn,v3MidAnchorOut);
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0,2,v3TargetPos,v3TarGetAnchorIn,v3TarGetAnchorOut);
}
}
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0, 0, v3FromPos, v3FromAnchorIn, v3FromAnchorOut);
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0, 1, v3MidPos, v3MidAnchorIn, v3MidAnchorOut);
m_kPath.GetComponent<MegaShapeArc>().SetKnotEx(0, 2, v3TargetPos, v3TarGetAnchorIn, v3TarGetAnchorOut);
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class arrowCtrl : MonoBehaviour {
public class arrowCtrl : MonoBehaviour
{
public GameObject[] m_karrow;
public GameObject[] m_karrow;
// Use this for initialization
void Start () {
}
// Use this for initialization
private void Start()
{
}
public void AllAlphaZero()
{
for(int i = 0;i<m_karrow.Length;i++)
{
if(m_karrow[i].GetComponent<AnimUnit>()!=null)
{
m_karrow[i].GetComponent<AnimUnit>().SetAllAlphaZero();
}
}
}
}
public void AllAlphaZero()
{
for (var i = 0; i < m_karrow.Length; i++)
if (m_karrow[i].GetComponent<AnimUnit>() != null)
m_karrow[i].GetComponent<AnimUnit>().SetAllAlphaZero();
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class blinding : MonoBehaviour {
public class blinding : MonoBehaviour
{
// Use this for initialization
private void Start()
{
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", (1f + Mathf.Sin(Time.time*10)) / 2f);
// Update is called once per frame
private void Update()
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", (1f + Mathf.Sin(Time.time * 10)) / 2f);
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: b71b024f995aa0843a87af2b3fae595e
folderAsset: yes
timeCreated: 1482167356
licenseType: Pro
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:
using UnityEngine;
using System.Collections;
public class arrow : MonoBehaviour {
public class arrow : MonoBehaviour
{
public float speed = 1;
public Transform from;
public Transform to;
public RendMega mega;
public MegaShapeArc arc;
// Use this for initialization
void Start ()
private void Start()
{
updateSpeed();
}
// Update is called once per frame
private void Update()
{
}
public void updateSpeed()
{
var list = GetComponentsInChildren<AnimUnit>();
foreach (var item in list)
{
item.m_fspeed = speed;
}
foreach (var item in list) item.m_fspeed = speed;
}
// Update is called once per frame
void Update () {
}
}
}
\ No newline at end of file

using UnityEngine;
using System.Collections;
using UnityEngine;
//设置在编辑模式下也执行该脚本
[ExecuteInEditMode]
......@@ -8,11 +6,32 @@ using System.Collections;
[AddComponentMenu("Learning Unity Shader/Lecture 15/RapidBlurEffect")]
public class RapidBlurEffect : MonoBehaviour
{
//-------------------------材质的get&set----------------------------
#region MaterialGetAndSet
private Material material
{
get
{
if (CurMaterial == null)
{
CurMaterial = new Material(CurShader);
CurMaterial.hideFlags = HideFlags.HideAndDontSave;
}
return CurMaterial;
}
}
#endregion
//-------------------变量声明部分-------------------
#region Variables
//指定Shader名称
private string ShaderName = "Learning Unity Shader/Lecture 15/RapidBlurEffect";
private readonly string ShaderName = "Learning Unity Shader/Lecture 15/RapidBlurEffect";
//着色器和材质实例
public Shader CurShader;
......@@ -24,38 +43,25 @@ public class RapidBlurEffect : MonoBehaviour
public static int ChangeValue3;
//降采样次数
[Range(0, 6), Tooltip("[降采样次数]向下采样的次数。此值越大,则采样间隔越大,需要处理的像素点越少,运行速度越快。")]
[Range(0, 6)] [Tooltip("[降采样次数]向下采样的次数。此值越大,则采样间隔越大,需要处理的像素点越少,运行速度越快。")]
public int DownSampleNum = 2;
//模糊扩散度
[Range(0.0f, 20.0f), Tooltip("[模糊扩散度]进行高斯模糊时,相邻像素点的间隔。此值越大相邻像素间隔越远,图像越模糊。但过大的值会导致失真。")]
[Range(0.0f, 20.0f)] [Tooltip("[模糊扩散度]进行高斯模糊时,相邻像素点的间隔。此值越大相邻像素间隔越远,图像越模糊。但过大的值会导致失真。")]
public float BlurSpreadSize = 3.0f;
//迭代次数
[Range(0, 8), Tooltip("[迭代次数]此值越大,则模糊操作的迭代次数越多,模糊效果越好,但消耗越大。")]
[Range(0, 8)] [Tooltip("[迭代次数]此值越大,则模糊操作的迭代次数越多,模糊效果越好,但消耗越大。")]
public int BlurIterations = 3;
#endregion
//-------------------------材质的get&set----------------------------
#region MaterialGetAndSet
Material material
{
get
{
if (CurMaterial == null)
{
CurMaterial = new Material(CurShader);
CurMaterial.hideFlags = HideFlags.HideAndDontSave;
}
return CurMaterial;
}
}
#endregion
#region Functions
//-----------------------------------------【Start()函数】---------------------------------------------
// 说明:此函数仅在Update函数第一次被调用前被调用
//--------------------------------------------------------------------------------------------------------
void Start()
private void Start()
{
//依次赋值
ChangeValue = DownSampleNum;
......@@ -69,55 +75,54 @@ public class RapidBlurEffect : MonoBehaviour
if (!SystemInfo.supportsImageEffects)
{
enabled = false;
return;
}
}
//-------------------------------------【OnRenderImage()函数】------------------------------------
// 说明:此函数在当完成所有渲染图片后被调用,用来渲染图片后期效果
//--------------------------------------------------------------------------------------------------------
void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
private void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
{
//着色器实例不为空,就进行参数设置
if (CurShader != null)
{
//【0】参数准备
//根据向下采样的次数确定宽度系数。用于控制降采样后相邻像素的间隔
float widthMod = 1.0f / (1.0f * (1 << DownSampleNum));
var widthMod = 1.0f / (1.0f * (1 << DownSampleNum));
//Shader的降采样参数赋值
material.SetFloat("_DownSampleValue", BlurSpreadSize * widthMod);
//设置渲染模式:双线性
sourceTexture.filterMode = FilterMode.Bilinear;
//通过右移,准备长、宽参数值
int renderWidth = sourceTexture.width >> DownSampleNum;
int renderHeight = sourceTexture.height >> DownSampleNum;
var renderWidth = sourceTexture.width >> DownSampleNum;
var renderHeight = sourceTexture.height >> DownSampleNum;
// 【1】处理Shader的通道0,用于降采样 ||Pass 0,for down sample
//准备一个缓存renderBuffer,用于准备存放最终数据
RenderTexture renderBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
var renderBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
//设置渲染模式:双线性
renderBuffer.filterMode = FilterMode.Bilinear;
//拷贝sourceTexture中的渲染数据到renderBuffer,并仅绘制指定的pass0的纹理数据
Graphics.Blit(sourceTexture, renderBuffer, material, 0);
//【2】根据BlurIterations(迭代次数),来进行指定次数的迭代操作
for (int i = 0; i < BlurIterations; i++)
for (var i = 0; i < BlurIterations; i++)
{
//【2.1】Shader参数赋值
//迭代偏移量参数
float iterationOffs = (i * 1.0f);
var iterationOffs = i * 1.0f;
//Shader的降采样参数赋值
material.SetFloat("_DownSampleValue", BlurSpreadSize * widthMod + iterationOffs);
// 【2.2】处理Shader的通道1,垂直方向模糊处理 || Pass1,for vertical blur
// 定义一个临时渲染的缓存tempBuffer
RenderTexture tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
var tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
// 拷贝renderBuffer中的渲染数据到tempBuffer,并仅绘制指定的pass1的纹理数据
Graphics.Blit(renderBuffer, tempBuffer, material, 1);
// 清空renderBuffer
RenderTexture.ReleaseTemporary(renderBuffer);
// 将tempBuffer赋给renderBuffer,此时renderBuffer里面pass0和pass1的数据已经准备好
renderBuffer = tempBuffer;
renderBuffer = tempBuffer;
// 【2.3】处理Shader的通道2,竖直方向模糊处理 || Pass2,for horizontal blur
// 获取临时渲染纹理
......@@ -136,7 +141,6 @@ public class RapidBlurEffect : MonoBehaviour
Graphics.Blit(renderBuffer, destTexture);
//清空renderBuffer
RenderTexture.ReleaseTemporary(renderBuffer);
}
//着色器实例为空,直接拷贝屏幕上的效果。此情况下是没有实现屏幕特效的
......@@ -151,7 +155,7 @@ public class RapidBlurEffect : MonoBehaviour
//-----------------------------------------【OnValidate()函数】--------------------------------------
// 说明:此函数在编辑器中该脚本的某个值发生了改变后被调用
//--------------------------------------------------------------------------------------------------------
void OnValidate()
private void OnValidate()
{
//将编辑器中的值赋值回来,确保在编辑器中值的改变立刻让结果生效
ChangeValue = DownSampleNum;
......@@ -162,7 +166,7 @@ public class RapidBlurEffect : MonoBehaviour
//-----------------------------------------【Update()函数】--------------------------------------
// 说明:此函数每帧都会被调用
//--------------------------------------------------------------------------------------------------------
void Update()
private void Update()
{
//若程序在运行,进行赋值
if (Application.isPlaying)
......@@ -174,27 +178,19 @@ public class RapidBlurEffect : MonoBehaviour
}
//若程序没有在运行,去寻找对应的Shader文件
#if UNITY_EDITOR
if (Application.isPlaying != true)
{
CurShader = Shader.Find(ShaderName);
}
if (Application.isPlaying != true) CurShader = Shader.Find(ShaderName);
#endif
}
//-----------------------------------------【OnDisable()函数】---------------------------------------
// 说明:当对象变为不可用或非激活状态时此函数便被调用
//--------------------------------------------------------------------------------------------------------
void OnDisable()
private void OnDisable()
{
if (CurMaterial)
{
//立即销毁材质实例
DestroyImmediate(CurMaterial);
}
}
#endregion
#endregion
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using UnityEngine;
public class UImouseHint : MonoBehaviour {
public class UImouseHint : MonoBehaviour
{
public GameObject point;
public Camera cam;
// Use this for initialization
void Start () {
private bool drag;
// Use this for initialization
private void Start()
{
try
{
cam = gameObject.transform.GetComponentInParent<UIRoot>().GetComponentInChildren<Camera>();
}
catch (System.Exception)
catch (Exception)
{
}
}
// Update is called once per frame
void Update()
}
// Update is called once per frame
private void Update()
{
if (drag)
{
point.transform.position = cam.ScreenToWorldPoint(new Vector3(
Input.mousePosition.x+5,
Input.mousePosition.y-25,0
));
}
Input.mousePosition.x + 5,
Input.mousePosition.y - 25, 0
));
}
bool drag = false;
public void begin()
{
drag = true;
......@@ -41,4 +42,4 @@ public class UImouseHint : MonoBehaviour {
drag = false;
point.SetActive(false);
}
}
}
\ No newline at end of file
using UnityEngine;
using System;
using TMPro;
using UnityEngine;
public class chainMono : MonoBehaviour {
public class chainMono : MonoBehaviour
{
public Renderer circle;
public TMPro.TextMeshPro text;
public TextMeshPro text;
public bool flashing = true;
float all = 0;
bool p = true;
void Update()
private float all;
private bool p = true;
private void Update()
{
if (flashing)
if (flashing)
{
all += Program.deltaTime;
if (all>0.05)
if (all > 0.05)
{
all = 0;
p = !p;
......@@ -29,4 +31,4 @@ public class chainMono : MonoBehaviour {
}
}
}
}
}
\ No newline at end of file
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEngine;
[CustomEditor(typeof(ParticleScale))]
public class ParticleScaleEditor : Editor {
void Awake() {
foreach(Transform tr in tgt.transform) {
if(tr.gameObject.GetComponent<ParticleScale>() == null) {
tr.gameObject.AddComponent<ParticleScale>();
}
}
}
public class ParticleScaleEditor : Editor
{
public ParticleScale tgt => target as ParticleScale;
public override void OnInspectorGUI() {
tgt.scaleStep = EditorGUILayout.FloatField("Scale Step", tgt.scaleStep);
private void Awake()
{
foreach (Transform tr in tgt.transform)
if (tr.gameObject.GetComponent<ParticleScale>() == null)
tr.gameObject.AddComponent<ParticleScale>();
}
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
public override void OnInspectorGUI()
{
tgt.scaleStep = EditorGUILayout.FloatField("Scale Step", tgt.scaleStep);
if(GUILayout.Button(new GUIContent("Scale Up"), GUILayout.Width(80))) {
UpdateScale(tgt.scaleStep);
}
if(GUILayout.Button(new GUIContent("Scale Down"), GUILayout.Width(80))) {
ReduceScale(tgt.scaleStep);
}
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
EditorGUILayout.Separator();
}
if (GUILayout.Button(new GUIContent("Scale Up"), GUILayout.Width(80))) UpdateScale(tgt.scaleStep);
private void UpdateScale(float mod) {
tgt.UpdateScale(mod);
foreach(Transform tr in tgt.transform) {
if(tr.gameObject.GetComponent<ParticleScale>() == null) {
tr.gameObject.AddComponent<ParticleScale>();
}
if (GUILayout.Button(new GUIContent("Scale Down"), GUILayout.Width(80))) ReduceScale(tgt.scaleStep);
tr.gameObject.GetComponent<ParticleScale>().UpdateScale(mod);
}
}
private void ReduceScale(float mod) {
tgt.ReduceScale(mod);
foreach(Transform tr in tgt.transform) {
if(tr.gameObject.GetComponent<ParticleScale>() == null) {
tr.gameObject.AddComponent<ParticleScale>();
}
tr.gameObject.GetComponent<ParticleScale>().ReduceScale(mod);
}
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.Separator();
}
public ParticleScale tgt {
get {
return target as ParticleScale;
}
}
private void UpdateScale(float mod)
{
tgt.UpdateScale(mod);
foreach (Transform tr in tgt.transform)
{
if (tr.gameObject.GetComponent<ParticleScale>() == null) tr.gameObject.AddComponent<ParticleScale>();
tr.gameObject.GetComponent<ParticleScale>().UpdateScale(mod);
}
}
private void ReduceScale(float mod)
{
tgt.ReduceScale(mod);
foreach (Transform tr in tgt.transform)
{
if (tr.gameObject.GetComponent<ParticleScale>() == null) tr.gameObject.AddComponent<ParticleScale>();
}
tr.gameObject.GetComponent<ParticleScale>().ReduceScale(mod);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class ParticleScale : MonoBehaviour {
public class ParticleScale : MonoBehaviour
{
public float scaleStep = 0.1f;
public float scaleStep = 0.1f;
private ParticleSystem _particle;
private ParticleSystem _particle = null;
public ParticleSystem particle
{
get
{
if (_particle == null) _particle = GetComponent<ParticleSystem>();
return _particle;
}
}
public void UpdateScale(float mod) {
if(particle == null) {
return;
}
public void UpdateScale(float mod)
{
if (particle == null) return;
particle.startSize = particle.startSize + particle.startSize * mod;
particle.startSpeed = particle.startSpeed + particle.startSpeed * mod;
}
particle.startSize = particle.startSize + particle.startSize * mod;
particle.startSpeed = particle.startSpeed + particle.startSpeed * mod;
}
public void ReduceScale(float mod) {
if(particle == null) {
return;
}
public void ReduceScale(float mod)
{
if (particle == null) return;
particle.startSize = particle.startSize - particle.startSize * mod;
particle.startSpeed = particle.startSpeed - particle.startSpeed * mod;
}
public ParticleSystem particle {
get {
if(_particle == null) {
_particle = GetComponent<ParticleSystem>();
}
return _particle;
}
}
}
particle.startSize = particle.startSize - particle.startSize * mod;
particle.startSpeed = particle.startSpeed - particle.startSpeed * mod;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class Galaxy_Rotation_01 : MonoBehaviour {
public class Galaxy_Rotation_01 : MonoBehaviour
{
// Use this for initialization
private void Start()
{
}
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
// Slowly rotate the object around its X axis at 1 degree/second.
transform.Rotate(Vector3.forward * Time.deltaTime*-10);
}
}
// Update is called once per frame
private void Update()
{
// Slowly rotate the object around its X axis at 1 degree/second.
transform.Rotate(Vector3.forward * Time.deltaTime * -10);
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using DG.Tweening;
public class MonoCardInDeckManager : MonoBehaviour {
int loadedPicCode = 0;
YGOSharp.Banlist loaded_banlist = null;
public bool dying = false;
bool died = false;
public YGOSharp.Card cardData=new YGOSharp.Card();
void Update ()
using DG.Tweening;
using UnityEngine;
using YGOSharp;
public class MonoCardInDeckManager : MonoBehaviour
{
public bool dying;
private bool bool_physicalON;
public Card cardData = new Card();
private bool died;
private bool isDraging;
private Banlist loaded_banlist;
private int loadedPicCode;
private void Update()
{
if (loadedPicCode != cardData.Id)
{
Texture2D pic = GameTextureManager.get(cardData.Id,GameTextureType.card_picture);
var pic = GameTextureManager.get(cardData.Id, GameTextureType.card_picture);
if (pic != null)
{
loadedPicCode = cardData.Id;
gameObject.transform.Find("face").GetComponent<Renderer>().material.mainTexture = pic;
}
}
if (Program.I().deckManager.currentBanlist != loaded_banlist)
{
ban_icon ico = GetComponentInChildren<ban_icon>();
var ico = GetComponentInChildren<ban_icon>();
loaded_banlist = Program.I().deckManager.currentBanlist;
if (loaded_banlist != null)
{
ico.show(loaded_banlist.GetQuantity(cardData.Id));
}
else
{
ico.show(3);
}
}
if (isDraging)
{
gameObject.transform.position += (getGoodPosition(4) - gameObject.transform.position) * 0.3f;
}
if (Vector3.Distance(Vector3.zero, gameObject.transform.position) > 50 && bool_physicalON)
{
killIt();
}
if (isDraging) gameObject.transform.position += (getGoodPosition(4) - gameObject.transform.position) * 0.3f;
if (Vector3.Distance(Vector3.zero, gameObject.transform.position) > 50 && bool_physicalON) killIt();
}
public void killIt()
......@@ -50,15 +46,9 @@ public class MonoCardInDeckManager : MonoBehaviour {
{
gameObject.transform.position = new Vector3(0, 5, 0);
endDrag();
if (Program.I().deckManager.cardInDragging==this)
{
Program.I().deckManager.cardInDragging = null;
}
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null)
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
if (Program.I().deckManager.cardInDragging == this) Program.I().deckManager.cardInDragging = null;
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
rigidbody.Sleep();
}
else
......@@ -71,22 +61,20 @@ public class MonoCardInDeckManager : MonoBehaviour {
public Vector3 getGoodPosition(float height)
{
float x = Input.mousePosition.x;
float y = Input.mousePosition.y;
Vector3 to_ltemp = Program.I().main_camera.ScreenToWorldPoint(new Vector3(x, y, 1));
Vector3 dv = to_ltemp - Program.I().main_camera.transform.position;
var x = Input.mousePosition.x;
var y = Input.mousePosition.y;
var to_ltemp = Program.I().main_camera.ScreenToWorldPoint(new Vector3(x, y, 1));
var dv = to_ltemp - Program.I().main_camera.transform.position;
if (dv.y == 0) dv.y = 0.01f;
to_ltemp.x = ((height - Program.I().main_camera.transform.position.y)
* (dv.x) / dv.y + Program.I().main_camera.transform.position.x);
to_ltemp.y = ((height - Program.I().main_camera.transform.position.y)
* (dv.y) / dv.y + Program.I().main_camera.transform.position.y);
to_ltemp.z = ((height - Program.I().main_camera.transform.position.y)
* (dv.z) / dv.y + Program.I().main_camera.transform.position.z);
to_ltemp.x = (height - Program.I().main_camera.transform.position.y)
* dv.x / dv.y + Program.I().main_camera.transform.position.x;
to_ltemp.y = (height - Program.I().main_camera.transform.position.y)
* dv.y / dv.y + Program.I().main_camera.transform.position.y;
to_ltemp.z = (height - Program.I().main_camera.transform.position.y)
* dv.z / dv.y + Program.I().main_camera.transform.position.z;
return to_ltemp;
}
bool isDraging = false;
public void beginDrag()
{
physicalOFF();
......@@ -101,21 +89,18 @@ public class MonoCardInDeckManager : MonoBehaviour {
isDraging = false;
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || getIfAlive() == false)
{
Vector3 form_position = getGoodPosition(4);
Vector3 to_position = getGoodPosition(0);
Vector3 delta_position = to_position - form_position;
var form_position = getGoodPosition(4);
var to_position = getGoodPosition(0);
var delta_position = to_position - form_position;
GetComponent<Rigidbody>().AddForce(delta_position * 1000);
dying = true;
}
}
public void tweenToVectorAndFall(Vector3 position,Vector3 rotation)
public void tweenToVectorAndFall(Vector3 position, Vector3 rotation)
{
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null)
{
rigidbody.Sleep();
}
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null) rigidbody.Sleep();
transform.DOMove(position, 0.2f).OnComplete(physicalON);
transform.DORotate(rotation, 0.15f);
......@@ -137,17 +122,12 @@ public class MonoCardInDeckManager : MonoBehaviour {
physicalOFF();
}
bool bool_physicalON = false;
private void physicalON()
{
bool_physicalON = true;
GetComponent<BoxCollider>().enabled = true;
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null)
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
rigidbody.Sleep();
rigidbody.useGravity = true;
rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
......@@ -157,11 +137,8 @@ public class MonoCardInDeckManager : MonoBehaviour {
{
bool_physicalON = false;
GetComponent<BoxCollider>().enabled = true;
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null)
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
rigidbody.useGravity = false;
rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
}
......@@ -170,46 +147,34 @@ public class MonoCardInDeckManager : MonoBehaviour {
{
bool_physicalON = false;
GetComponent<BoxCollider>().enabled = false;
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null)
{
rigidbody.useGravity = false;
}
var rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null) rigidbody.useGravity = false;
}
public bool getIfAlive()
{
bool ret = true;
if (died == true)
{
ret = false;
}
if (gameObject.transform.position.y < -0.5f)
{
ret = false;
}
Vector3 to_ltemp = refLectPosition(gameObject.transform.position);
var ret = true;
if (died) ret = false;
if (gameObject.transform.position.y < -0.5f) ret = false;
var to_ltemp = refLectPosition(gameObject.transform.position);
if (to_ltemp.x < -15.2f) ret = false;
if (to_ltemp.x > 15.2f) ret = false;
if (Program.I().deckManager.condition == DeckManager.Condition.changeSide)
{
ret = true;
}
if (Program.I().deckManager.condition == DeckManager.Condition.changeSide) ret = true;
return ret;
}
public static Vector3 refLectPosition(Vector3 pos)
{
Vector3 to_ltemp = pos;
Vector3 dv = to_ltemp - Program.I().main_camera.transform.position;
var to_ltemp = pos;
var dv = to_ltemp - Program.I().main_camera.transform.position;
if (dv.y == 0) dv.y = 0.01f;
to_ltemp.x = ((0 - Program.I().main_camera.transform.position.y)
* (dv.x) / dv.y + Program.I().main_camera.transform.position.x);
to_ltemp.y = ((0 - Program.I().main_camera.transform.position.y)
* (dv.y) / dv.y + Program.I().main_camera.transform.position.y);
to_ltemp.z = ((0 - Program.I().main_camera.transform.position.y)
* (dv.z) / dv.y + Program.I().main_camera.transform.position.z);
to_ltemp.x = (0 - Program.I().main_camera.transform.position.y)
* dv.x / dv.y + Program.I().main_camera.transform.position.x;
to_ltemp.y = (0 - Program.I().main_camera.transform.position.y)
* dv.y / dv.y + Program.I().main_camera.transform.position.y;
to_ltemp.z = (0 - Program.I().main_camera.transform.position.y)
* dv.z / dv.y + Program.I().main_camera.transform.position.z;
return to_ltemp;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using YGOSharp;
public class cardPicLoader : MonoBehaviour
{
public int loaded_code = -1;
public int code = 0;
public YGOSharp.Banlist loaded_banlist = null;
public int code;
public Texture2D defaults = null;
public Texture2D defaults;
public ban_icon ico;
public void clear()
{
loaded_code = 0;
code = 0;
ico.show(3);
uiTexture.mainTexture = null;
}
public Collider coli;
public void reCode(int c)
{
loaded_code = 0;
code = c;
}
public UITexture uiTexture;
public void relayer(int l)
{
uiTexture.depth = 50 + l * 2;
UITexture t = ico.gameObject.GetComponent<UITexture>();
t.depth = 51 + l * 2;
}
public Banlist loaded_banlist;
public Collider coli = null;
public Card data { get; set; }
void Update()
private void Update()
{
if (coli != null)
{
if (Program.InputGetMouseButtonDown_0)
{
if (Program.pointedCollider == coli)
{
((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true);
}
}
}
Program.I().cardDescription.setData(CardsManager.Get(code), GameTextureManager.myBack, "", true);
if (Program.I().deckManager != null)
{
if (loaded_code != code)
{
Texture2D t = GameTextureManager.get(code, GameTextureType.card_picture, defaults);
var t = GameTextureManager.get(code, GameTextureType.card_picture, defaults);
if (t != null)
{
uiTexture.mainTexture = t;
uiTexture.aspectRatio = ((float)t.width) / ((float)t.height);
uiTexture.forceWidth((int)(uiTexture.height * uiTexture.aspectRatio));
uiTexture.aspectRatio = t.width / (float) t.height;
uiTexture.forceWidth((int) (uiTexture.height * uiTexture.aspectRatio));
loaded_code = code;
loaded_banlist = null;
}
}
if (loaded_banlist != Program.I().deckManager.currentBanlist)
{
loaded_banlist = Program.I().deckManager.currentBanlist;
......@@ -73,13 +50,31 @@ public class cardPicLoader : MonoBehaviour
ico.show(3);
return;
}
ico.show(loaded_banlist.GetQuantity(code));
}
}
}
}
public UITexture uiTexture;
public void clear()
{
loaded_code = 0;
code = 0;
ico.show(3);
uiTexture.mainTexture = null;
}
public YGOSharp.Card data { get; set; }
}
public void reCode(int c)
{
loaded_code = 0;
code = c;
}
public void relayer(int l)
{
uiTexture.depth = 50 + l * 2;
var t = ico.gameObject.GetComponent<UITexture>();
t.depth = 51 + l * 2;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class descKeeper : MonoBehaviour {
public class descKeeper : MonoBehaviour
{
public UITexture card;
public UITexture back;
// Use this for initialization
void Start()
private void Start()
{
}
// Update is called once per frame
void Update () {
if (back.width < card.width)
{
back.width = card.width + 2;
}
private void Update()
{
if (back.width < card.width) back.width = card.width + 2;
back.transform.localPosition = new Vector3(back.width / 2f, 0);
Vector3 leftTop = new Vector3(-back.width / 2 + 2 + back.transform.localPosition.x, +back.height / 2 - 2 + back.transform.localPosition.y);
var leftTop = new Vector3(-back.width / 2 + 2 + back.transform.localPosition.x,
+back.height / 2 - 2 + back.transform.localPosition.y);
card.transform.localPosition = new Vector3(leftTop.x + card.width / 2, leftTop.y - card.height / 2);
Program.I().cardDescription.width = back.width-2;
Program.I().cardDescription.width = back.width - 2;
Program.I().cardDescription.cHeight = card.height;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using UnityEngine;
public class forceColor : MonoBehaviour {
// Use this for initialization
void Start () {
public class forceColor : MonoBehaviour
{
// Use this for initialization
private void Start()
{
var tweens = GetComponentsInChildren<TweenColor>();
foreach (var item in tweens)
{
DestroyImmediate(item);
}
foreach (var item in tweens) DestroyImmediate(item);
Color c;
ColorUtility.TryParseHtmlString(Config.Getui("allUI.color"), out c);
var sprites = GetComponentsInChildren<UISprite>();
foreach (var item in sprites)
{
foreach (var item in sprites)
if (item.color.a > 0.1f)
{
item.color = c;
......@@ -22,11 +19,11 @@ public class forceColor : MonoBehaviour {
{
item.gameObject.GetComponentInParent<UIButton>().defaultColor = c;
}
catch (System.Exception)
catch (Exception)
{
}
}
}
ColorUtility.TryParseHtmlString(Config.Getui("List.color"), out c);
var lists = GetComponentsInChildren<UIPopupList>();
foreach (var item in lists)
......@@ -37,10 +34,11 @@ public class forceColor : MonoBehaviour {
item.gameObject.GetComponent<UISprite>().color = c;
item.gameObject.GetComponent<UIButton>().defaultColor = c;
}
catch (System.Exception)
catch (Exception)
{
}
}
ColorUtility.TryParseHtmlString(Config.Getui("lable.color"), out c);
var ls = GetComponentsInChildren<UILabel>();
foreach (var item in ls)
......@@ -49,16 +47,14 @@ public class forceColor : MonoBehaviour {
item.gradientTop = c;
item.gradientBottom = Color.gray;
}
ColorUtility.TryParseHtmlString(Config.Getui("lable.color.fadecolor"), out c);
ls = GetComponentsInChildren<UILabel>();
foreach (var item in ls)
{
item.gradientBottom = c;
}
foreach (var item in ls) item.gradientBottom = c;
}
// Update is called once per frame
private void Update()
{
}
// Update is called once per frame
void Update () {
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using System.IO;
using UnityEngine;
public class barPngLoader : MonoBehaviour {
public class barPngLoader : MonoBehaviour
{
public UITexture under;
public UIPanel healthBarCC;
public UIPanel timeBarCC;
public UIPanel faceCC;
public UIPanel faceCC;
public UITexture api_healthBar;
public UITexture api_timeBar;
public UITexture api_face;
public UILabel api_name;
public UILabel api_timeHint;
public UILabel api_healthHint;
// Use this for initialization
void Start () {
private void Start()
{
under.mainTexture = GameTextureManager.bar;
api_healthBar.mainTexture = GameTextureManager.lp;
api_timeBar.mainTexture = GameTextureManager.time;
try
{
string[] allLines = (File.ReadAllText("texture/duel/healthBar/config.txt").Replace("\r", "").Replace(" ", "").Split("\n"));
var allLines = File.ReadAllText("texture/duel/healthBar/config.txt").Replace("\r", "").Replace(" ", "")
.Split("\n");
foreach (var item in allLines)
{
string[] mats = item.Split("=");
var mats = item.Split("=");
if (mats.Length == 2)
{
Color c;
......@@ -31,7 +36,8 @@ public class barPngLoader : MonoBehaviour {
{
case "totalSize.width":
under.width = int.Parse(mats[1]);
under.transform.localPosition = new Vector3(-float.Parse(mats[1]) / 2f, under.transform.localPosition.y, 0);
under.transform.localPosition = new Vector3(-float.Parse(mats[1]) / 2f,
under.transform.localPosition.y, 0);
break;
case "flatType":
if (int.Parse(mats[1]) == 1)
......@@ -44,16 +50,20 @@ public class barPngLoader : MonoBehaviour {
healthBarCC.clipSoftness = new Vector2(4, 4);
timeBarCC.clipSoftness = new Vector2(4, 4);
}
break;
case "totalSize.height":
under.height = int.Parse(mats[1]);
under.transform.localPosition = new Vector3(under.transform.localPosition.x, -float.Parse(mats[1]) / 2f, 0);
under.transform.localPosition = new Vector3(under.transform.localPosition.x,
-float.Parse(mats[1]) / 2f, 0);
break;
case "playerNameLable.x":
api_name.transform.localPosition = new Vector3(-float.Parse(mats[1]), api_name.transform.localPosition.y, 0);
api_name.transform.localPosition = new Vector3(-float.Parse(mats[1]),
api_name.transform.localPosition.y, 0);
break;
case "playerNameLable.y":
api_name.transform.localPosition = new Vector3(api_name.transform.localPosition.x, -float.Parse(mats[1]), 0);
api_name.transform.localPosition = new Vector3(api_name.transform.localPosition.x,
-float.Parse(mats[1]), 0);
break;
case "playerNameLable.width":
api_name.width = int.Parse(mats[1]);
......@@ -62,43 +72,27 @@ public class barPngLoader : MonoBehaviour {
api_name.height = int.Parse(mats[1]);
break;
case "playerNameLable.color":
ColorUtility.TryParseHtmlString(mats[1],out c);
ColorUtility.TryParseHtmlString(mats[1], out c);
api_name.color = c;
api_name.gradientTop = api_name.color;
break;
case "playerNameLable.alignment":
if (mats[1] == "0")
{
api_name.alignment = NGUIText.Alignment.Center;
}
if (mats[1] == "1")
{
api_name.alignment = NGUIText.Alignment.Left;
}
if (mats[1] == "2")
{
api_name.alignment = NGUIText.Alignment.Right;
}
if (mats[1] == "0") api_name.alignment = NGUIText.Alignment.Center;
if (mats[1] == "1") api_name.alignment = NGUIText.Alignment.Left;
if (mats[1] == "2") api_name.alignment = NGUIText.Alignment.Right;
break;
case "playerNameLable.effect":
if (mats[1] == "0")
{
api_name.effectStyle = UILabel.Effect.None;
}
if (mats[1] == "1")
{
api_name.effectStyle = UILabel.Effect.Shadow;
}
if (mats[1] == "2")
{
api_name.effectStyle = UILabel.Effect.Outline;
}
if (mats[1] == "0") api_name.effectStyle = UILabel.Effect.None;
if (mats[1] == "1") api_name.effectStyle = UILabel.Effect.Shadow;
if (mats[1] == "2") api_name.effectStyle = UILabel.Effect.Outline;
break;
case "healthLable.x":
api_healthHint.transform.localPosition = new Vector3(-float.Parse(mats[1]), api_healthHint.transform.localPosition.y, 0);
api_healthHint.transform.localPosition = new Vector3(-float.Parse(mats[1]),
api_healthHint.transform.localPosition.y, 0);
break;
case "healthLable.y":
api_healthHint.transform.localPosition = new Vector3(api_healthHint.transform.localPosition.x, -float.Parse(mats[1]), 0);
api_healthHint.transform.localPosition =
new Vector3(api_healthHint.transform.localPosition.x, -float.Parse(mats[1]), 0);
break;
case "healthLable.width":
api_healthHint.width = int.Parse(mats[1]);
......@@ -112,38 +106,22 @@ public class barPngLoader : MonoBehaviour {
api_healthHint.gradientTop = api_name.color;
break;
case "healthLable.alignment":
if (mats[1] == "0")
{
api_healthHint.alignment = NGUIText.Alignment.Center;
}
if (mats[1] == "1")
{
api_healthHint.alignment = NGUIText.Alignment.Left;
}
if (mats[1] == "2")
{
api_healthHint.alignment = NGUIText.Alignment.Right;
}
if (mats[1] == "0") api_healthHint.alignment = NGUIText.Alignment.Center;
if (mats[1] == "1") api_healthHint.alignment = NGUIText.Alignment.Left;
if (mats[1] == "2") api_healthHint.alignment = NGUIText.Alignment.Right;
break;
case "healthLable.effect":
if (mats[1] == "0")
{
api_healthHint.effectStyle = UILabel.Effect.None;
}
if (mats[1] == "1")
{
api_healthHint.effectStyle = UILabel.Effect.Shadow;
}
if (mats[1] == "2")
{
api_healthHint.effectStyle = UILabel.Effect.Outline;
}
if (mats[1] == "0") api_healthHint.effectStyle = UILabel.Effect.None;
if (mats[1] == "1") api_healthHint.effectStyle = UILabel.Effect.Shadow;
if (mats[1] == "2") api_healthHint.effectStyle = UILabel.Effect.Outline;
break;
case "timeLable.x":
api_timeHint.transform.localPosition = new Vector3(-float.Parse(mats[1]), api_timeHint.transform.localPosition.y, 0);
api_timeHint.transform.localPosition = new Vector3(-float.Parse(mats[1]),
api_timeHint.transform.localPosition.y, 0);
break;
case "timeLable.y":
api_timeHint.transform.localPosition = new Vector3(api_timeHint.transform.localPosition.x, -float.Parse(mats[1]), 0);
api_timeHint.transform.localPosition = new Vector3(api_timeHint.transform.localPosition.x,
-float.Parse(mats[1]), 0);
break;
case "timeLable.width":
api_timeHint.width = int.Parse(mats[1]);
......@@ -157,100 +135,87 @@ public class barPngLoader : MonoBehaviour {
api_timeHint.gradientTop = api_name.color;
break;
case "timeLable.alignment":
if (mats[1] == "0")
{
api_timeHint.alignment = NGUIText.Alignment.Center;
}
if (mats[1] == "1")
{
api_timeHint.alignment = NGUIText.Alignment.Left;
}
if (mats[1] == "2")
{
api_timeHint.alignment = NGUIText.Alignment.Right;
}
if (mats[1] == "0") api_timeHint.alignment = NGUIText.Alignment.Center;
if (mats[1] == "1") api_timeHint.alignment = NGUIText.Alignment.Left;
if (mats[1] == "2") api_timeHint.alignment = NGUIText.Alignment.Right;
break;
case "timeLable.effect":
if (mats[1] == "0")
{
api_timeHint.effectStyle = UILabel.Effect.None;
}
if (mats[1] == "1")
{
api_timeHint.effectStyle = UILabel.Effect.Shadow;
}
if (mats[1] == "2")
{
api_timeHint.effectStyle = UILabel.Effect.Outline;
}
if (mats[1] == "0") api_timeHint.effectStyle = UILabel.Effect.None;
if (mats[1] == "1") api_timeHint.effectStyle = UILabel.Effect.Shadow;
if (mats[1] == "2") api_timeHint.effectStyle = UILabel.Effect.Outline;
break;
case "health.x":
healthBarCC.transform.localPosition = new Vector3(-float.Parse(mats[1]), healthBarCC.transform.localPosition.y, 0);
healthBarCC.transform.localPosition = new Vector3(-float.Parse(mats[1]),
healthBarCC.transform.localPosition.y, 0);
api_healthBar.transform.localPosition = Vector3.zero;
break;
case "health.y":
healthBarCC.transform.localPosition = new Vector3(healthBarCC.transform.localPosition.x, -float.Parse(mats[1]), 0);
healthBarCC.transform.localPosition = new Vector3(healthBarCC.transform.localPosition.x,
-float.Parse(mats[1]), 0);
api_healthBar.transform.localPosition = Vector3.zero;
break;
case "health.width":
healthBarCC.baseClipRegion = new Vector4(healthBarCC.baseClipRegion.x, healthBarCC.baseClipRegion.y, float.Parse(mats[1]), healthBarCC.baseClipRegion.w);
healthBarCC.baseClipRegion = new Vector4(healthBarCC.baseClipRegion.x,
healthBarCC.baseClipRegion.y, float.Parse(mats[1]), healthBarCC.baseClipRegion.w);
api_healthBar.width = int.Parse(mats[1]);
break;
case "health.height":
healthBarCC.baseClipRegion = new Vector4(healthBarCC.baseClipRegion.x, healthBarCC.baseClipRegion.y, healthBarCC.baseClipRegion.z, float.Parse(mats[1]));
healthBarCC.baseClipRegion = new Vector4(healthBarCC.baseClipRegion.x,
healthBarCC.baseClipRegion.y, healthBarCC.baseClipRegion.z, float.Parse(mats[1]));
api_healthBar.height = int.Parse(mats[1]);
break;
case "time.x":
timeBarCC.transform.localPosition = new Vector3(-float.Parse(mats[1]), timeBarCC.transform.localPosition.y, 0);
timeBarCC.transform.localPosition = new Vector3(-float.Parse(mats[1]),
timeBarCC.transform.localPosition.y, 0);
api_timeBar.transform.localPosition = Vector3.zero;
break;
case "time.y":
timeBarCC.transform.localPosition = new Vector3(timeBarCC.transform.localPosition.x, -float.Parse(mats[1]), 0);
timeBarCC.transform.localPosition = new Vector3(timeBarCC.transform.localPosition.x,
-float.Parse(mats[1]), 0);
api_timeBar.transform.localPosition = Vector3.zero;
break;
case "time.width":
timeBarCC.baseClipRegion = new Vector4(timeBarCC.baseClipRegion.x, timeBarCC.baseClipRegion.y, float.Parse(mats[1]), timeBarCC.baseClipRegion.w);
timeBarCC.baseClipRegion = new Vector4(timeBarCC.baseClipRegion.x,
timeBarCC.baseClipRegion.y, float.Parse(mats[1]), timeBarCC.baseClipRegion.w);
api_timeBar.width = int.Parse(mats[1]);
break;
case "time.height":
timeBarCC.baseClipRegion = new Vector4(timeBarCC.baseClipRegion.x, timeBarCC.baseClipRegion.y, timeBarCC.baseClipRegion.z, float.Parse(mats[1]));
timeBarCC.baseClipRegion = new Vector4(timeBarCC.baseClipRegion.x,
timeBarCC.baseClipRegion.y, timeBarCC.baseClipRegion.z, float.Parse(mats[1]));
api_timeBar.height = int.Parse(mats[1]);
break;
case "face.x":
faceCC.transform.localPosition = new Vector3(-float.Parse(mats[1]), faceCC.transform.localPosition.y, 0);
faceCC.transform.localPosition = new Vector3(-float.Parse(mats[1]),
faceCC.transform.localPosition.y, 0);
api_timeBar.transform.localPosition = Vector3.zero;
break;
case "face.y":
faceCC.transform.localPosition = new Vector3(faceCC.transform.localPosition.x, -float.Parse(mats[1]), 0);
faceCC.transform.localPosition = new Vector3(faceCC.transform.localPosition.x,
-float.Parse(mats[1]), 0);
api_timeBar.transform.localPosition = Vector3.zero;
break;
case "face.size":
faceCC.baseClipRegion = new Vector4(faceCC.baseClipRegion.x, faceCC.baseClipRegion.y, float.Parse(mats[1]), float.Parse(mats[1]));
faceCC.baseClipRegion = new Vector4(faceCC.baseClipRegion.x, faceCC.baseClipRegion.y,
float.Parse(mats[1]), float.Parse(mats[1]));
api_face.width = int.Parse(mats[1]);
api_face.height = int.Parse(mats[1]);
break;
case "face.type":
if (mats[1] == "0")
{
faceCC.clipping = UIDrawCall.Clipping.TextureMask;
}
if (mats[1] == "1")
{
faceCC.clipping = UIDrawCall.Clipping.SoftClip;
}
if (mats[1] == "0") faceCC.clipping = UIDrawCall.Clipping.TextureMask;
if (mats[1] == "1") faceCC.clipping = UIDrawCall.Clipping.SoftClip;
break;
}
}
}
}
catch (System.Exception e)
catch (Exception e)
{
Debug.LogError(e);
}
}
// Update is called once per frame
void Update () {
}
}
// Update is called once per frame
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System;
using System;
using System.Collections.Generic;
using UnityEngine;
public class gameUIbutton
{
public string hashString;
public bool dead;
public bool dying;
public GameObject gameObject;
public string hashString;
public int response;
public bool dying;
public bool dead;
}
public class gameInfo : MonoBehaviour
{
public enum chainCondition
{
standard,
no,
all,
smart
}
public UITexture instance_btnPan;
public UITextList instance_lab;
public UIToggle toggle_ignore;
......@@ -20,143 +28,115 @@ public class gameInfo : MonoBehaviour
public UIToggle toggle_smart;
public GameObject line;
public void on_toggle_ignore()
{
toggle_all.value = false;
toggle_smart.value = false;
}
public GameObject mod_healthBar;
public void on_toggle_all()
{
toggle_ignore.value = false;
toggle_smart.value = false;
}
public float width;
public void on_toggle_smart()
{
toggle_ignore.value = false;
toggle_all.value = false;
}
public bool swaped;
//public UITextList hinter;
private readonly List<gameUIbutton> HashedButtons = new List<gameUIbutton>();
barPngLoader me;
private readonly bool[] isTicking = new bool[2];
barPngLoader opponent;
private int lastTickTime;
public GameObject mod_healthBar;
//public UITextList hinter;
public float width = 0;
private barPngLoader me;
int lastTickTime = 0;
private barPngLoader opponent;
private readonly int[] time = new int[2];
// Use this for initialization
void Start()
private void Start()
{
ini();
}
public void ini()
{
Update();
}
public bool swaped = false;
void Update()
private void Update()
{
if (me == null || opponent == null)
{
me = ((GameObject)MonoBehaviour.Instantiate(mod_healthBar, new Vector3(1000, 0, 0), Quaternion.identity)).GetComponent<barPngLoader>();
me = Instantiate(mod_healthBar, new Vector3(1000, 0, 0), Quaternion.identity).GetComponent<barPngLoader>();
me.transform.SetParent(gameObject.transform);
opponent = ((GameObject)MonoBehaviour.Instantiate(mod_healthBar, new Vector3(1000, 0, 0), Quaternion.identity)).GetComponent<barPngLoader>();
opponent = Instantiate(mod_healthBar, new Vector3(1000, 0, 0), Quaternion.identity)
.GetComponent<barPngLoader>();
opponent.transform.SetParent(gameObject.transform);
Transform[] Transforms = me.GetComponentsInChildren<Transform>();
foreach (Transform child in Transforms)
{
child.gameObject.layer = gameObject.layer;
}
var Transforms = me.GetComponentsInChildren<Transform>();
foreach (var child in Transforms) child.gameObject.layer = gameObject.layer;
Transforms = opponent.GetComponentsInChildren<Transform>();
foreach (Transform child in Transforms)
{
child.gameObject.layer = gameObject.layer;
}
foreach (var child in Transforms) child.gameObject.layer = gameObject.layer;
Color c;
ColorUtility.TryParseHtmlString(Config.Getui("gameChainCheckArea.color"), out c);
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "ignore_").gameObject, "Background").color = c;
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "watch_").gameObject, "Background").color = c;
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "use_").gameObject, "Background").color = c;
}
float k = ((float)(Screen.width - Program.I().cardDescription.width)) / 1200f;
if (k > 1.2f)
{
k = 1.2f;
}
if (k <0.8f)
{
k = 0.8f;
}
Vector3 ks = new Vector3(k, k, k);
float kb = ((float)(Screen.width - Program.I().cardDescription.width)) / 1200f;
if (kb > 1.2f)
{
kb = 1.2f;
}
if (kb < 0.73f)
{
kb = 0.73f;
}
Vector3 ksb = new Vector3(kb, kb, kb);
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "ignore_").gameObject, "Background")
.color = c;
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "watch_").gameObject, "Background")
.color = c;
UIHelper.getByName<UISprite>(UIHelper.getByName<UIToggle>(gameObject, "use_").gameObject, "Background")
.color = c;
}
var k = (Screen.width - Program.I().cardDescription.width) / 1200f;
if (k > 1.2f) k = 1.2f;
if (k < 0.8f) k = 0.8f;
var ks = new Vector3(k, k, k);
var kb = (Screen.width - Program.I().cardDescription.width) / 1200f;
if (kb > 1.2f) kb = 1.2f;
if (kb < 0.73f) kb = 0.73f;
var ksb = new Vector3(kb, kb, kb);
instance_btnPan.gameObject.transform.localScale = ksb;
opponent.transform.localScale = ks;
me.transform.localScale = ks;
if (!swaped)
if (!swaped)
{
opponent.transform.localPosition = new Vector3(Screen.width / 2-14, Screen.height / 2 - 14);
me.transform.localPosition = new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14 - k * (float)(opponent.under.height));
opponent.transform.localPosition = new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14);
me.transform.localPosition =
new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14 - k * opponent.under.height);
}
else
{
me.transform.localPosition = new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14);
opponent.transform.localPosition = new Vector3(Screen.width / 2-14, Screen.height / 2 - 14 - k * (float)(opponent.under.height));
opponent.transform.localPosition =
new Vector3(Screen.width / 2 - 14, Screen.height / 2 - 14 - k * opponent.under.height);
}
width = (150 * kb) + 15f;
float localPositionPanX = (((float)Screen.width - 150 * kb) / 2) - 15f;
width = 150 * kb + 15f;
var localPositionPanX = (Screen.width - 150 * kb) / 2 - 15f;
instance_btnPan.transform.localPosition = new Vector3(localPositionPanX, 145, 0);
instance_lab.transform.localPosition = new Vector3(Screen.width/2-315, -Screen.height / 2+90, 0);
int j = 0;
for (int i = 0; i < HashedButtons.Count; i++)
{
if (HashedButtons[i].gameObject != null)
instance_lab.transform.localPosition = new Vector3(Screen.width / 2 - 315, -Screen.height / 2 + 90, 0);
var j = 0;
foreach (var t in HashedButtons)
if (t.gameObject != null)
{
if (HashedButtons[i].dying)
if (t.dying)
{
HashedButtons[i].gameObject.transform.localPosition += (new Vector3(0, -120, 0) - HashedButtons[i].gameObject.transform.localPosition) * Program.deltaTime * 20f;
if (Math.Abs(HashedButtons[i].gameObject.transform.localPosition.y - -120) < 1)
HashedButtons[i].dead = true;
t.gameObject.transform.localPosition +=
(new Vector3(0, -120, 0) - t.gameObject.transform.localPosition) *
Program.deltaTime * 20f;
if (Math.Abs(t.gameObject.transform.localPosition.y - -120) < 1)
t.dead = true;
}
else
{
HashedButtons[i].gameObject.transform.localPosition += (new Vector3(0, -145 - j * 50, 0) - HashedButtons[i].gameObject.transform.localPosition) * Program.deltaTime * 10f;
t.gameObject.transform.localPosition +=
(new Vector3(0, -145 - j * 50, 0) - t.gameObject.transform.localPosition) *
Program.deltaTime * 10f;
j++;
}
}
else
HashedButtons[i].dead = true;
}
for (int i = HashedButtons.Count - 1; i >= 0; i--)
{
{
t.dead = true;
}
for (var i = HashedButtons.Count - 1; i >= 0; i--)
if (HashedButtons[i].dead)
HashedButtons.RemoveAt(i);
}
float height = 132 + 50 * j;
if (j == 0)
{
height = 116;
}
instance_btnPan.height += (int)(((float)height - (float)instance_btnPan.height) * 0.2f);
if (j == 0) height = 116;
instance_btnPan.height += (int) ((height - instance_btnPan.height) * 0.2f);
if (Program.TimePassed() - lastTickTime > 1000)
{
lastTickTime = Program.TimePassed();
......@@ -164,32 +144,47 @@ public class gameInfo : MonoBehaviour
}
}
List<gameUIbutton> HashedButtons = new List<gameUIbutton>();
public void on_toggle_ignore()
{
toggle_all.value = false;
toggle_smart.value = false;
}
public void on_toggle_all()
{
toggle_ignore.value = false;
toggle_smart.value = false;
}
public void on_toggle_smart()
{
toggle_ignore.value = false;
toggle_all.value = false;
}
public void ini()
{
Update();
}
public void addHashedButton(string hashString_, int hashInt, superButtonType type, string hint)
{
gameUIbutton hashedButton = new gameUIbutton();
string hashString = hashString_;
if (hashString == "")
{
hashString = hashInt.ToString();
}
var hashedButton = new gameUIbutton();
var hashString = hashString_;
if (hashString == "") hashString = hashInt.ToString();
hashedButton.hashString = hashString;
hashedButton.response = hashInt;
hashedButton.gameObject = Program.I().create(Program.I().new_ui_superButtonTransparent);
UIHelper.trySetLableText(hashedButton.gameObject, "hint_", hint);
UIHelper.getRealEventGameObject(hashedButton.gameObject).name = hashString + "----" + hashInt.ToString();
UIHelper.getRealEventGameObject(hashedButton.gameObject).name = hashString + "----" + hashInt;
UIHelper.registUIEventTriggerForClick(hashedButton.gameObject, listenerForClicked);
hashedButton.gameObject.GetComponent<iconSetForButton>().setTexture(type);
hashedButton.gameObject.GetComponent<iconSetForButton>().setText(hint);
Transform[] Transforms = hashedButton.gameObject.GetComponentsInChildren<Transform>();
foreach (Transform child in Transforms)
{
child.gameObject.layer = instance_btnPan.gameObject.layer;
}
hashedButton.gameObject.transform.SetParent(instance_btnPan.transform,false);
var Transforms = hashedButton.gameObject.GetComponentsInChildren<Transform>();
foreach (var child in Transforms) child.gameObject.layer = instance_btnPan.gameObject.layer;
hashedButton.gameObject.transform.SetParent(instance_btnPan.transform, false);
hashedButton.gameObject.transform.localScale = Vector3.zero;
hashedButton.gameObject.transform.localPosition= new Vector3(0, -120, 0);
hashedButton.gameObject.transform.localPosition = new Vector3(0, -120, 0);
hashedButton.gameObject.transform.localEulerAngles = Vector3.zero;
iTween.ScaleTo(hashedButton.gameObject, new Vector3(0.9f, 0.9f, 0.9f), 0.3f);
hashedButton.dying = false;
......@@ -197,94 +192,62 @@ public class gameInfo : MonoBehaviour
refreshLine();
}
void listenerForClicked(GameObject obj)
private void listenerForClicked(GameObject obj)
{
string[] mats = obj.name.Split("----");
var mats = obj.name.Split("----");
if (mats.Length == 2)
{
for (int i = 0; i < HashedButtons.Count; i++)
{
for (var i = 0; i < HashedButtons.Count; i++)
if (HashedButtons[i].hashString == mats[0])
{
if (HashedButtons[i].response.ToString() == mats[1])
{
Program.I().ocgcore.ES_gameUIbuttonClicked(HashedButtons[i]);
}
}
}
}
}
public bool queryHashedButton(string hashString)
{
for (int i = 0; i < HashedButtons.Count; i++)
{
for (var i = 0; i < HashedButtons.Count; i++)
if (HashedButtons[i].hashString == hashString && !HashedButtons[i].dying)
{
return true;
}
}
return false;
}
public void removeHashedButton(string hashString)
{
gameUIbutton remove = null;
for (int i = 0; i < HashedButtons.Count; i++)
{
for (var i = 0; i < HashedButtons.Count; i++)
if (HashedButtons[i].hashString == hashString)
{
remove = HashedButtons[i];
}
}
if (remove != null)
{
if (remove.gameObject != null)
{
Program.I().destroy(remove.gameObject, 0.3f, true);
}
if (remove.gameObject != null) Program.I().destroy(remove.gameObject, 0.3f, true);
remove.dying = true;
}
refreshLine();
}
public void removeAll()
{
if (HashedButtons.Count == 1)
{
if (HashedButtons[0].hashString == "swap")
{
return;
}
}
for (int i = 0; i < HashedButtons.Count; i++)
for (var i = 0; i < HashedButtons.Count; i++)
{
if (HashedButtons[i].gameObject != null)
{
Program.I().destroy(HashedButtons[i].gameObject, 0.3f, true);
}
if (HashedButtons[i].gameObject != null) Program.I().destroy(HashedButtons[i].gameObject, 0.3f, true);
HashedButtons[i].dying = true;
}
refreshLine();
}
void refreshLine()
private void refreshLine()
{
int j = 0;
for (int i = 0; i < HashedButtons.Count; i++)
{
var j = 0;
for (var i = 0; i < HashedButtons.Count; i++)
if (!HashedButtons[i].dying)
{
j++;
}
}
line.SetActive(j > 0);
}
int[] time = new int[2];
bool[] isTicking = new bool[2];
public void setTime(int player, int t)
{
if (player < 2)
......@@ -293,7 +256,6 @@ public class gameInfo : MonoBehaviour
setTimeAbsolutely(player, t);
isTicking[player] = true;
isTicking[1 - player] = false;
}
}
......@@ -312,7 +274,7 @@ public class gameInfo : MonoBehaviour
}
public void setTimeStill(int player)
public void setTimeStill(int player)
{
time[0] = Program.I().ocgcore.timeLimit;
time[1] = Program.I().ocgcore.timeLimit;
......@@ -330,6 +292,7 @@ public class gameInfo : MonoBehaviour
opponent.under.mainTexture = GameTextureManager.exBar;
me.under.mainTexture = GameTextureManager.bar;
}
if (Program.I().ocgcore.timeLimit == 0)
{
me.api_timeHint.text = "infinite";
......@@ -347,103 +310,85 @@ public class gameInfo : MonoBehaviour
return time[0] < Program.I().ocgcore.timeLimit / 3;
}
void setTimeAbsolutely(int player, int t)
private void setTimeAbsolutely(int player, int t)
{
if (Program.I().ocgcore.timeLimit == 0)
{
return;
}
if (Program.I().ocgcore.timeLimit == 0) return;
if (player == 0)
{
me.api_timeHint.text = t.ToString() + "/" + Program.I().ocgcore.timeLimit.ToString();
me.api_timeHint.text = t + "/" + Program.I().ocgcore.timeLimit;
opponent.api_timeHint.text = "waiting";
UIHelper.clearITWeen(me.api_healthBar.gameObject);
iTween.MoveToLocal(me.api_timeBar.gameObject, new Vector3((float)(me.api_timeBar.width) - (float)t / (float)Program.I().ocgcore.timeLimit * (float)(me.api_timeBar.width), me.api_healthBar.gameObject.transform.localPosition.y, me.api_healthBar.gameObject.transform.localPosition.z), 1f);
iTween.MoveToLocal(me.api_timeBar.gameObject,
new Vector3(me.api_timeBar.width - t / (float) Program.I().ocgcore.timeLimit * me.api_timeBar.width,
me.api_healthBar.gameObject.transform.localPosition.y,
me.api_healthBar.gameObject.transform.localPosition.z), 1f);
}
if (player == 1)
{
opponent.api_timeHint.text = t.ToString() + "/" + Program.I().ocgcore.timeLimit.ToString();
opponent.api_timeHint.text = t + "/" + Program.I().ocgcore.timeLimit;
me.api_timeHint.text = "waiting";
UIHelper.clearITWeen(opponent.api_healthBar.gameObject);
iTween.MoveToLocal(opponent.api_timeBar.gameObject, new Vector3((float)(opponent.api_timeBar.width) - (float)t / (float)Program.I().ocgcore.timeLimit * (float)(opponent.api_timeBar.width), opponent.api_healthBar.gameObject.transform.localPosition.y, opponent.api_healthBar.gameObject.transform.localPosition.z), 1f);
iTween.MoveToLocal(opponent.api_timeBar.gameObject,
new Vector3(
opponent.api_timeBar.width - t / (float) Program.I().ocgcore.timeLimit * opponent.api_timeBar.width,
opponent.api_healthBar.gameObject.transform.localPosition.y,
opponent.api_healthBar.gameObject.transform.localPosition.z), 1f);
}
}
public void realize()
{
me.api_healthHint.text = ((float)Program.I().ocgcore.life_0 > 0 ? Program.I().ocgcore.life_0 : 0).ToString();
opponent.api_healthHint.text = ((float)Program.I().ocgcore.life_1 > 0 ? Program.I().ocgcore.life_1 : 0).ToString();
me.api_healthHint.text = ((float) Program.I().ocgcore.life_0 > 0 ? Program.I().ocgcore.life_0 : 0).ToString();
opponent.api_healthHint.text =
((float) Program.I().ocgcore.life_1 > 0 ? Program.I().ocgcore.life_1 : 0).ToString();
me.api_name.text = Program.I().ocgcore.name_0_c;
opponent.api_name.text = Program.I().ocgcore.name_1_c;
me.api_face.mainTexture = UIHelper.getFace(Program.I().ocgcore.name_0_c);
opponent.api_face.mainTexture = UIHelper.getFace(Program.I().ocgcore.name_1_c);
iTween.MoveToLocal(me.api_healthBar.gameObject, new Vector3(
(float)(me.api_healthBar.width) - getRealLife(Program.I().ocgcore.life_0) / ((float)Program.I().ocgcore.lpLimit) * (float)(me.api_healthBar.width),
me.api_healthBar.width - getRealLife(Program.I().ocgcore.life_0) / Program.I().ocgcore.lpLimit *
me.api_healthBar.width,
me.api_healthBar.gameObject.transform.localPosition.y,
me.api_healthBar.gameObject.transform.localPosition.z), 1f);
iTween.MoveToLocal(opponent.api_healthBar.gameObject, new Vector3(
(float)(opponent.api_healthBar.width) - getRealLife(Program.I().ocgcore.life_1) / ((float)Program.I().ocgcore.lpLimit) * (float)(opponent.api_healthBar.width),
opponent.api_healthBar.width - getRealLife(Program.I().ocgcore.life_1) / Program.I().ocgcore.lpLimit *
opponent.api_healthBar.width,
opponent.api_healthBar.gameObject.transform.localPosition.y,
opponent.api_healthBar.gameObject.transform.localPosition.z), 1f);
instance_lab.Clear();
if (Program.I().ocgcore.confirmedCards.Count>0)
{
instance_lab.Add(GameStringHelper.yijingqueren);
}
foreach (var item in Program.I().ocgcore.confirmedCards)
{
instance_lab.Add(item);
}
if (Program.I().ocgcore.confirmedCards.Count > 0) instance_lab.Add(GameStringHelper.yijingqueren);
foreach (var item in Program.I().ocgcore.confirmedCards) instance_lab.Add(item);
}
static float getRealLife(float in_)
private static float getRealLife(float in_)
{
if (in_ < 0)
{
return 0;
}
if (in_ > Program.I().ocgcore.lpLimit)
{
return Program.I().ocgcore.lpLimit;
}
if (in_ < 0) return 0;
if (in_ > Program.I().ocgcore.lpLimit) return Program.I().ocgcore.lpLimit;
return in_;
}
void tick()
private void tick()
{
if (isTicking[0])
{
if (time[0] > 0)
{
time[0]--;
}
if (amIdanger())
{
if (time[0] > 0) time[0]--;
if (amIdanger())
if (Program.I().ocgcore != null)
{
Program.I().ocgcore.dangerTicking();
}
}
setTimeAbsolutely(0, time[0]);
}
if (isTicking[1])
{
if (time[1] > 0)
{
time[1]--;
}
if (time[1] > 0) time[1]--;
setTimeAbsolutely(1, time[1]);
}
}
public enum chainCondition
{
standard,no,all,smart
}
public void set_condition(chainCondition c)
{
switch (c)
switch (c)
{
case chainCondition.standard:
toggle_all.value = false;
......@@ -470,19 +415,10 @@ public class gameInfo : MonoBehaviour
public chainCondition get_condition()
{
chainCondition res = chainCondition.standard;
if (toggle_ignore.value)
{
res = chainCondition.no;
}
if (toggle_smart.value)
{
res = chainCondition.smart;
}
if (toggle_all.value)
{
res = chainCondition.all;
}
var res = chainCondition.standard;
if (toggle_ignore.value) res = chainCondition.no;
if (toggle_smart.value) res = chainCondition.smart;
if (toggle_all.value) res = chainCondition.all;
return res;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using System;
using UnityEngine;
using Random = UnityEngine.Random;
public class priority_floating : MonoBehaviour
{
int open = 0;
private int open;
// Use this for initialization
void Start()
private void Start()
{
open = Program.TimePassed() - UnityEngine.Random.Range(0, 500);
open = Program.TimePassed() - Random.Range(0, 500);
}
// Update is called once per frame
void Update()
private void Update()
{
gameObject.transform.localPosition = new Vector3(0, 10*(float)Math.Sin(3.1415936f * (float)(Program.TimePassed() - open) / 500f), 0);
gameObject.transform.localPosition =
new Vector3(0, 10 * (float) Math.Sin(3.1415936f * (Program.TimePassed() - open) / 500f), 0);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class spriteChanger : MonoBehaviour {
public class spriteChanger : MonoBehaviour
{
public UITexture toBeChangedUITexture;
public Texture2D[] texts = new Texture2D[6];
public void change(int i)
{
if(i>0){
if (i > 0)
if (i < texts.Length)
{
toBeChangedUITexture.mainTexture=texts[i];
}
}
toBeChangedUITexture.mainTexture = texts[i];
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class mouseParticle : MonoBehaviour {
public class mouseParticle : MonoBehaviour
{
public Camera camera;
public ParticleSystem e1;
public ParticleSystem e2;
public Transform trans;
private float time = 0;
// Use this for initialization
void Start () {
private void Start()
{
camera.depth = 99999;
}
float time = 0;
// Update is called once per frame
void Update () {
Vector3 screenPoint = Input.mousePosition;
// Update is called once per frame
private void Update()
{
var screenPoint = Input.mousePosition;
screenPoint.z = 10;
trans.position = camera.ScreenToWorldPoint(screenPoint);
......@@ -29,4 +34,4 @@ public class mouseParticle : MonoBehaviour {
e2.Stop();
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class panelKIller : MonoBehaviour {
UIPanel pan;
bool on = false;
public class panelKIller : MonoBehaviour
{
private bool on;
public void ini()
{
pan = GetComponentInChildren<UIPanel>();
}
private UIPanel pan;
public void set(bool r)
{
on = r;
if (pan != null)
{
if (r)
{
pan.alpha = 0;
}
}
}
// Update is called once per frame
void Update () {
private void Update()
{
if (pan != null)
{
float to =0;
if (on)
{
to = 1;
}
float to = 0;
if (on) to = 1;
if (Mathf.Abs(to - pan.alpha) > 0.1f)
{
pan.alpha += (to - pan.alpha) * Program.deltaTime * 18;
}
else
{
if (pan.alpha != to)
{
pan.alpha = to;
}
if (pan.alpha != to) pan.alpha = to;
}
}
}
}
public void ini()
{
pan = GetComponentInChildren<UIPanel>();
}
public void set(bool r)
{
on = r;
if (pan != null)
if (r)
pan.alpha = 0;
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class faceShower : MonoBehaviour {
void Start () {
gameObject.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width/2,Screen.height*1.5f,0));
iTween.MoveToAction(gameObject, Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height/2, 0)),0.6f,()=>{
iTween.ScaleToAction(gameObject,Vector3.zero, 0.6f, () => {
Destroy(gameObject);
}, 1f);
},0);
}
}
public class faceShower : MonoBehaviour
{
private void Start()
{
gameObject.transform.position = Program.I().camera_main_2d
.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
iTween.MoveToAction(gameObject,
Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 0)), 0.6f,
() => { iTween.ScaleToAction(gameObject, Vector3.zero, 0.6f, () => { Destroy(gameObject); }, 1f); });
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class handShower : MonoBehaviour
{
public Texture2D[] pics = new Texture2D[3];
public int op = 0;
public int me = 0;
public int op;
public int me;
public UITexture texture_0;
public UITexture texture_1;
public GameObject GameObject_0;
public GameObject GameObject_1;
void Start()
private void Start()
{
pics[0] = GameTextureManager.get("jiandao");
pics[1] = GameTextureManager.get("shitou");
pics[2] = GameTextureManager.get("bu");
texture_0.mainTexture = pics[me];
texture_1.mainTexture = pics[op];
GameObject_0.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, -Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_0, Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f, () => {
Destroy(GameObject_0,0.3f);
}, 0);
GameObject_1.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_1, Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 + 80, 0)), 1f, () => {
Destroy(GameObject_1, 0.3f);
}, 0);
GameObject_0.transform.position = Program.I().camera_main_2d
.ScreenToWorldPoint(new Vector3(Screen.width / 2, -Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_0,
Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f,
() => { Destroy(GameObject_0, 0.3f); });
GameObject_1.transform.position = Program.I().camera_main_2d
.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
iTween.MoveToAction(GameObject_1,
Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 + 80, 0)), 1f,
() => { Destroy(GameObject_1, 0.3f); });
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class lazyBookbtns : MonoBehaviour {
public class lazyBookbtns : MonoBehaviour
{
public UILabel lable;
public UITextList textlist;
public UISprite back;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
}
private void Start()
{
}
// Update is called once per frame
private void Update()
{
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
public class lazyPlayer : MonoBehaviour {
using System;
using UnityEngine;
public class lazyPlayer : MonoBehaviour
{
public UIToggle prep;
public UIButton prepAsButton;
public UIButton prepAsCollider;
public UIButton prepAsCollider;
public UIButton kickAsButton;
public UISprite prepAsTexture;
public UISprite prepAsTexture;
public UILabel UILabel_name;
......@@ -22,63 +21,62 @@ public class lazyPlayer : MonoBehaviour {
public Transform transformOfPrepFore;
int me = 0;
private bool canKick;
public void ini()
{
me = int.Parse(gameObject.name);
setIfprepared(false);
setIfMe(false);
SetNotNull(false);
SetIFcanKick(false);
setName("");
}
private int me;
private bool mIfMe;
private string mName;
private bool NotNull;
public Action<int> onKick = null;
public Action<int, bool> onPrepareChanged = null;
// Use this for initialization
void Start ()
private void Start()
{
UIHelper.registEvent(prepAsButton, OnPrepClicked);
UIHelper.registEvent(kickAsButton, OnKickClicked);
// ini();
// ini();
}
// Update is called once per frame
void Update()
private void Update()
{
}
public void ini()
{
me = int.Parse(gameObject.name);
setIfprepared(false);
setIfMe(false);
SetNotNull(false);
SetIFcanKick(false);
setName("");
}
void OnPrepClicked()
private void OnPrepClicked()
{
if (onPrepareChanged != null)
{
onPrepareChanged(me, prep.value);
}
if (onPrepareChanged != null) onPrepareChanged(me, prep.value);
}
void OnKickClicked()
private void OnKickClicked()
{
Program.DEBUGLOG("OnKickClicked " + me.ToString());
if (onKick != null)
{
onKick(me);
}
Program.DEBUGLOG("OnKickClicked " + me);
if (onKick != null) onKick(me);
//setIfMe(!getIfMe());//bb
}
bool canKick = false;
public void SetIFcanKick(bool canKick_)
{
canKick = canKick_;
if (canKick)
{
kickAsButton.gameObject.SetActive(true);
}
else
{
kickAsButton.gameObject.SetActive(false);
}
}
public bool getIfcanKick()
......@@ -86,8 +84,6 @@ public class lazyPlayer : MonoBehaviour {
return canKick;
}
bool NotNull = false;
public void SetNotNull(bool notNull_)
{
NotNull = notNull_;
......@@ -108,8 +104,6 @@ public class lazyPlayer : MonoBehaviour {
return NotNull;
}
bool mIfMe = false;
public void setIfMe(bool isMe)
{
mIfMe = isMe;
......@@ -132,8 +126,6 @@ public class lazyPlayer : MonoBehaviour {
return mIfMe;
}
string mName;
public void setName(string name_)
{
mName = name_;
......@@ -153,10 +145,6 @@ public class lazyPlayer : MonoBehaviour {
return mName;
}
public Action<int, bool> onPrepareChanged = null;
public Action<int> onKick = null;
public void setIfprepared(bool preped)
{
prep.value = preped;
......@@ -166,4 +154,4 @@ public class lazyPlayer : MonoBehaviour {
{
return prep.value;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class spining : MonoBehaviour {
void Update () {
transform.localEulerAngles+=(Vector3.forward * Program.deltaTime * 160);
public class spining : MonoBehaviour
{
private void Update()
{
transform.localEulerAngles += Vector3.forward * Program.deltaTime * 160;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public enum superButtonType
{
act, attack, bp,
change, ep, mp,
no, see, set,
spsummon, summon, yes,
act,
attack,
bp,
change,
ep,
mp,
no,
see,
set,
spsummon,
summon,
yes
}
public class iconSetForButton : MonoBehaviour
{
public UITexture UITextureInButton;
public UILabel UILabelInButton;
public Texture2D act;
......@@ -26,9 +32,10 @@ public class iconSetForButton : MonoBehaviour
public Texture2D spsummon;
public Texture2D summon;
public Texture2D yes;
public void setTexture(superButtonType type)
{
switch (type)
switch (type)
{
case superButtonType.act:
UITextureInButton.mainTexture = act;
......@@ -67,12 +74,14 @@ public class iconSetForButton : MonoBehaviour
UITextureInButton.mainTexture = yes;
break;
}
Color c;
ColorUtility.TryParseHtmlString(Config.Getui("gameButtonSign.color"), out c);
UITextureInButton.color = c;
}
public void setText(string hint)
{
UILabelInButton.text = hint;
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class hinter : MonoBehaviour {
public class hinter : MonoBehaviour
{
public string str;
bool loaded = false;
UIEventTrigger trigger = null;
// Use this for initialization
void Start () {
private bool loaded;
private GameObject obj;
private UIEventTrigger trigger;
// Use this for initialization
private void Start()
{
trigger = GetComponent<UIEventTrigger>();
if (trigger==null)
{
trigger = gameObject.AddComponent<UIEventTrigger>();
}
if (trigger == null) trigger = gameObject.AddComponent<UIEventTrigger>();
trigger.onHoverOver.Add(new EventDelegate(this, "in_"));
trigger.onHoverOut.Add(new EventDelegate(this, "out_"));
trigger.onPress.Add(new EventDelegate(this, "out_"));
}
GameObject obj;
// Update is called once per frame
private void Update()
{
if (loaded == false)
if (InterString.loaded)
{
loaded = true;
str = InterString.Get(str);
}
}
void in_()
private void in_()
{
Vector3 screenPosition = Program.I().camera_main_2d.WorldToScreenPoint(gameObject.GetComponentInChildren<UITexture>().gameObject.transform.position);
var screenPosition = Program.I().camera_main_2d
.WorldToScreenPoint(gameObject.GetComponentInChildren<UITexture>().gameObject.transform.position);
screenPosition.y += 45;
screenPosition.z = 0;
Vector3 worldPositin = Program.I().camera_main_2d.ScreenToWorldPoint(screenPosition);
obj = Program.I().create(Program.I().mod_simple_ngui_text, worldPositin, Vector3.zero, true, Program.I().ui_main_2d, true);
var worldPositin = Program.I().camera_main_2d.ScreenToWorldPoint(screenPosition);
obj = Program.I().create(Program.I().mod_simple_ngui_text, worldPositin, Vector3.zero, true,
Program.I().ui_main_2d);
obj.GetComponent<UILabel>().text = str;
obj.GetComponent<UILabel>().effectStyle = UILabel.Effect.Outline;
Program.I().destroy(obj, 5f, false, false);
Program.I().destroy(obj, 5f);
}
void out_()
{
if (obj!=null)
{
Program.I().destroy(obj, 0.6f, true, true);
}
}
// Update is called once per frame
void Update()
private void out_()
{
if (loaded == false)
{
if (InterString.loaded == true)
{
loaded = true;
str = InterString.Get(str);
}
}
if (obj != null) Program.I().destroy(obj, 0.6f, true, true);
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
using System;
using UnityEngine;
public class setbar : MonoBehaviour {
public void show(){
public class setbar : MonoBehaviour
{
public void show()
{
try
{
if (Program.I().setting.isShowed)
{
Program.I().setting.hide();
}
else
{
Program.I().setting.show();
}
}
catch (System.Exception)
catch (Exception)
{
}
}
public void book()
{
try
{
if (Program.I().book.isShowed)
{
Program.I().book.hide();
}
else
{
Program.I().book.show();
}
}
catch (System.Exception)
catch (Exception)
{
}
}
}
}
\ No newline at end of file
using UnityEngine;
using System.Collections;
public class toolShift : MonoBehaviour {
public GameObject ObjectMust = null;
public GameObject ObjectOption = null;
public class toolShift : MonoBehaviour
{
public GameObject ObjectMust;
public GameObject ObjectOption;
void Update()
private void Update()
{
if (Program.InputEnterDown)
{
if (ObjectMust.name == "input_")
{
UIInput input = UIHelper.getByName<UIInput>(ObjectMust, "input_");
var input = UIHelper.getByName<UIInput>(ObjectMust, "input_");
if (input != null)
{
if (ObjectMust.transform.localPosition.y < 0)
......@@ -36,26 +35,21 @@ public class toolShift : MonoBehaviour {
}
}
}
}
}
public void shift()
{
Vector3 va = ObjectMust.transform.localPosition;
var va = ObjectMust.transform.localPosition;
if (ObjectOption == null)
{
if (va.y >= 0)
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f);
}
else
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, 0, va.z), 0.6f);
}
}
else
{
Vector3 vb = ObjectOption.transform.localPosition;
var vb = ObjectOption.transform.localPosition;
if (va.y > vb.y)
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f);
......@@ -68,4 +62,4 @@ public class toolShift : MonoBehaviour {
}
}
}
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment