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

code reformat

parent 5771b093
using UnityEngine; using UnityEngine;
using System.Collections;
public class ContinuesButton : MonoBehaviour { public class ContinuesButton : MonoBehaviour
UIButton btn; {
private UIButton btn;
private bool isTrigging;
// Update is called once per frame
private float time;
// Use this for initialization // Use this for initialization
void Start () private void Start()
{ {
btn = GetComponentInChildren<UIButton>(); btn = GetComponentInChildren<UIButton>();
UIEventTrigger trigger= gameObject.GetComponentInChildren<UIEventTrigger>(); var trigger = gameObject.GetComponentInChildren<UIEventTrigger>();
if (trigger==null) if (trigger == null) trigger = gameObject.AddComponent<UIEventTrigger>();
{
trigger = gameObject.AddComponent<UIEventTrigger>();
}
trigger.onRelease.Add(new EventDelegate(this, "off")); trigger.onRelease.Add(new EventDelegate(this, "off"));
trigger.onPress.Add(new EventDelegate(this, "on")); trigger.onPress.Add(new EventDelegate(this, "on"));
} }
void on() private void Update()
{ {
isTrigging = true;
time = 0;
}
void off()
{
isTrigging = false;
time = 0;
}
bool isTrigging = false;
// Update is called once per frame
float time = 0;
void Update () {
if (isTrigging) if (isTrigging)
{ if (btn != null)
if (btn!=null)
{ {
time += Time.deltaTime; time += Time.deltaTime;
if (time > 0.2f) if (time > 0.2f)
...@@ -44,5 +32,16 @@ public class ContinuesButton : MonoBehaviour { ...@@ -44,5 +32,16 @@ public class ContinuesButton : MonoBehaviour {
} }
} }
} }
private void on()
{
isTrigging = true;
time = 0;
}
private void off()
{
isTrigging = false;
time = 0;
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class MONO_wait : MonoBehaviour { public class MONO_wait : MonoBehaviour
{
public UILabel lab; public UILabel lab;
string s = ""; private float a;
private string s = "";
// Use this for initialization // Use this for initialization
void Start () private void Start()
{ {
s = InterString.Get("等待对方行动中"); s = InterString.Get("等待对方行动中");
} }
float a = 0;
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
a += Time.deltaTime;
string t = "";
for (int i = 0; i < (((int)(a * 60)) / 20) % 4; i++)
{ {
t += InterString.Get("…"); a += Time.deltaTime;
} var t = "";
for (var i = 0; i < (int) (a * 60) / 20 % 4; i++) t += InterString.Get("…");
lab.text = t + s + t; lab.text = t + s + t;
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class lazyBTNMOVER : MonoBehaviour {
public class lazyBTNMOVER : MonoBehaviour
{
public UILabel g1; public UILabel g1;
public UILabel g2; public UILabel g2;
public UILabel g3; public UILabel g3;
......
using UnityEngine; using System;
using System.Collections; using UnityEngine;
using System;
public class phaser : MonoBehaviour {
public Action mp2Action;
public Action bpAction;
public Action epAction;
public class phaser : MonoBehaviour
{
public BoxCollider colliderMp2; public BoxCollider colliderMp2;
public BoxCollider colliderBp; public BoxCollider colliderBp;
public BoxCollider colliderEp; public BoxCollider colliderEp;
...@@ -18,38 +13,30 @@ public class phaser : MonoBehaviour { ...@@ -18,38 +13,30 @@ public class phaser : MonoBehaviour {
public UILabel labBp; public UILabel labBp;
public UILabel labMp2; public UILabel labMp2;
public UILabel labEp; public UILabel labEp;
public Action bpAction;
public Action epAction;
// Use this for initialization public Action mp2Action;
void Start () {
// Use this for initialization
private void Start()
{
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
if (Program.InputGetMouseButtonUp_0)
{
if (Program.pointedCollider== colliderMp2)
{ {
if (mp2Action!=null) if (Program.InputGetMouseButtonUp_0)
{ {
if (Program.pointedCollider == colliderMp2)
if (mp2Action != null)
mp2Action(); mp2Action();
}
}
if (Program.pointedCollider == colliderBp) if (Program.pointedCollider == colliderBp)
{
if (bpAction != null) if (bpAction != null)
{
bpAction(); bpAction();
}
}
if (Program.pointedCollider == colliderEp) if (Program.pointedCollider == colliderEp)
{
if (epAction != null) if (epAction != null)
{
epAction(); epAction();
} }
} }
}
}
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class pngSord : MonoBehaviour {
public class pngSord : MonoBehaviour
{
// Use this for initialization // Use this for initialization
void Start () { private void Start()
{
gameObject.GetComponent<Renderer>().material.mainTexture = GameTextureManager.attack; 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 // 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 public class OpenCardOnClick : MonoBehaviour
{ {
void OnClick() private void OnClick()
{ {
UILabel lbl = GetComponent<UILabel>(); var lbl = GetComponent<UILabel>();
if (lbl != null) if (lbl != null)
{
try try
{ {
string s = lbl.GetUrlAtPosition(UICamera.lastWorldPosition); var s = lbl.GetUrlAtPosition(UICamera.lastWorldPosition);
if (string.IsNullOrEmpty(s)) if (string.IsNullOrEmpty(s)) return;
{ var code = int.Parse(s);
return; Program.I().cardDescription.setData(CardsManager.Get(code), GameTextureManager.myBack, "", true);
} }
int code = int.Parse(s); catch (Exception e)
((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true);
}
catch (System.Exception e)
{ {
Debug.Log(e); Debug.Log(e);
} }
} }
}
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class smartSelection : MonoBehaviour { public class smartSelection : MonoBehaviour
{
public UILabel name_lable; public UILabel name_lable;
public UITexture under_; public UITexture under_;
...@@ -17,7 +17,7 @@ public class smartSelection : MonoBehaviour { ...@@ -17,7 +17,7 @@ public class smartSelection : MonoBehaviour {
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()
...@@ -27,7 +27,7 @@ public class smartSelection : MonoBehaviour { ...@@ -27,7 +27,7 @@ public class smartSelection : MonoBehaviour {
public void set_width(int width) public void set_width(int width)
{ {
int w = width + 80; var w = width + 80;
under_.width = w; under_.width = w;
collider.size = new Vector3(w, under_.height + 5, 1); collider.size = new Vector3(w, under_.height + 5, 1);
collider.center = new Vector3(0, -2.5f, 0); collider.center = new Vector3(0, -2.5f, 0);
...@@ -36,10 +36,7 @@ public class smartSelection : MonoBehaviour { ...@@ -36,10 +36,7 @@ public class smartSelection : MonoBehaviour {
public static void IselectedSetter(GameObject obj, bool selected) public static void IselectedSetter(GameObject obj, bool selected)
{ {
smartSelection smartSelection = obj.GetComponent<smartSelection>(); var smartSelection = obj.GetComponent<smartSelection>();
if (smartSelection != null) if (smartSelection != null) smartSelection.setSelected(selected);
{
smartSelection.setSelected(selected);
}
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class LAZYsetting : MonoBehaviour { public class LAZYsetting : MonoBehaviour
{
public UISlider sliderVolum; public UISlider sliderVolum;
public UISlider sliderSizeDrawing; public UISlider sliderSizeDrawing;
public UISlider sliderSize; public UISlider sliderSize;
...@@ -42,12 +42,12 @@ public class LAZYsetting : MonoBehaviour { ...@@ -42,12 +42,12 @@ public class LAZYsetting : MonoBehaviour {
public UIToggle spyer; public UIToggle spyer;
// Use this for initialization // Use this for initialization
void Start () { private void Start()
{
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
{
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class YGO1superShower : MonoBehaviour { public class YGO1superShower : MonoBehaviour
{
public UITexture card; public UITexture card;
public UITexture closeup; public UITexture closeup;
// Use this for initialization
void Start () {
// Use this for initialization
private void Start()
{
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
{
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class pro1CardShower : MonoBehaviour { public class pro1CardShower : MonoBehaviour
{
public UITexture card; public UITexture card;
public UITexture mask; public UITexture mask;
public UITexture disable; public UITexture disable;
......
using UnityEngine; using UnityEngine;
using System.Collections;
public class rotatotr : MonoBehaviour {
public class rotatotr : MonoBehaviour
{
// Use this for initialization // Use this for initialization
void Start () { private void Start()
{
} }
// Update is called once per frame // Update is called once per frame
void Update() private void Update()
{ {
transform.Rotate(Vector3.forward * Time.deltaTime * 80); transform.Rotate(Vector3.forward * Time.deltaTime * 80);
} }
......
 using UnityEngine;
using UnityEngine;
using System.Collections;
public class AnimUnit : MonoBehaviour public class AnimUnit : MonoBehaviour
{ {
public float m_fspeed = 1; public float m_fspeed = 1;
private MegaWorldPathDeform m_kMWPD = null;
private MegaShapeArc m_kShapeArc = null;
private float m_fAccumAnimOffset = 0.0f; private float m_fAccumAnimOffset;
private float m_fArrowHeadLenth = 0.57f;
private readonly float m_fArrowHeadLenth = 0.57f;
//private float m_fRGB = 1/255.0f; //private float m_fRGB = 1/255.0f;
private float m_fHigh = 1.0f; //画线高度定值 --CardGame private readonly float m_fHigh = 1.0f; //画线高度定值 --CardGame
void Start() private MegaWorldPathDeform m_kMWPD;
private MegaShapeArc m_kShapeArc;
private void Start()
{ {
m_kMWPD = GetComponent<MegaWorldPathDeform> (); m_kMWPD = GetComponent<MegaWorldPathDeform>();
m_fAccumAnimOffset = m_kMWPD.Offset.z; m_fAccumAnimOffset = m_kMWPD.Offset.z;
//Debug.Log ("offset val is " + m_kAccumAnimOffset + " when init"); //Debug.Log ("offset val is " + m_kAccumAnimOffset + " when init");
...@@ -26,12 +25,11 @@ public class AnimUnit : MonoBehaviour ...@@ -26,12 +25,11 @@ public class AnimUnit : MonoBehaviour
//Color color = new Color(141* m_fRGB, m_fRGB, m_fRGB); //Color color = new Color(141* m_fRGB, m_fRGB, m_fRGB);
//this.gameObject.renderer.material.SetColor("_BlendColor",color); //this.gameObject.renderer.material.SetColor("_BlendColor",color);
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0); gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
} }
void Update() private void Update()
{ {
// float fnowoffset = m_kShapeArc.GetCurveLength (0) - m_fAccumAnimOffset; // float fnowoffset = m_kShapeArc.GetCurveLength (0) - m_fAccumAnimOffset;
// //
// float linelenth = (m_kShapeArc.GetCurveLength (0) - (m_fArrowHeadLenth*0.04f)/2 + 0.764f)/5; // float linelenth = (m_kShapeArc.GetCurveLength (0) - (m_fArrowHeadLenth*0.04f)/2 + 0.764f)/5;
...@@ -56,30 +54,16 @@ public class AnimUnit : MonoBehaviour ...@@ -56,30 +54,16 @@ public class AnimUnit : MonoBehaviour
} }
// void AlphaSet() private void FixedUpdate()
// {
// m_kShapeArc.GetCurveLength (0);
// }
public void SetAllAlphaZero()
{ {
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0); if (m_kShapeArc == null) return;
}
void FixedUpdate()
{
if (m_kShapeArc == null)
{
return;
}
m_fAccumAnimOffset += -m_fspeed * Time.deltaTime; m_fAccumAnimOffset += -m_fspeed * Time.deltaTime;
//if (m_fAccumAnimOffset >= m_kShapeArc.GetCurveLength (0)-(m_fArrowHeadLenth*0.02f)/2 - 0.382f) //if (m_fAccumAnimOffset >= m_kShapeArc.GetCurveLength (0)-(m_fArrowHeadLenth*0.02f)/2 - 0.382f)
if (m_fAccumAnimOffset <= (m_fArrowHeadLenth*0.04f)/2 + 0.764f) if (m_fAccumAnimOffset <= m_fArrowHeadLenth * 0.04f / 2 + 0.764f)
{ {
//m_fAccumAnimOffset = 0.0f; //m_fAccumAnimOffset = 0.0f;
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0); gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
m_kShapeArc.GetComponent<LoopPathAnim>().moveToTail(m_kMWPD); m_kShapeArc.GetComponent<LoopPathAnim>().moveToTail(m_kMWPD);
} }
...@@ -105,36 +89,35 @@ public class AnimUnit : MonoBehaviour ...@@ -105,36 +89,35 @@ 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) if (fnowoffset > 0 && fnowoffset <= m_fHigh)
{ {
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",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) else if (fnowoffset > m_fHigh && fnowoffset <= m_kShapeArc.GetCurveLength(0) - m_fHigh - linelenth)
{ {
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0.7f); gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0.7f);
} }
else if(fnowoffset>m_kShapeArc.GetCurveLength (0) - m_fHigh - linelenth && fnowoffset<=m_kShapeArc.GetCurveLength (0)) 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; var f = (1 - (fnowoffset - m_kShapeArc.GetCurveLength(0) + m_fHigh + linelenth) / m_fHigh) * 0.7f;
//if (f > 0.05f) //if (f > 0.05f)
//{ //{
// f = 1; // f = 1;
//} //}
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",f); gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", f);
} }
else else
{ {
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha",0); gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
} }
//float linelenth = m_kShapeArc.GetCurveLength (0)/5; //float linelenth = m_kShapeArc.GetCurveLength (0)/5;
//设置alpha //设置alpha
// if(fnowoffset>0&&fnowoffset<= linelenth) // if(fnowoffset>0&&fnowoffset<= linelenth)
...@@ -155,6 +138,17 @@ public class AnimUnit : MonoBehaviour ...@@ -155,6 +138,17 @@ public class AnimUnit : MonoBehaviour
// } // }
} }
// void AlphaSet()
// {
// m_kShapeArc.GetCurveLength (0);
// }
public void SetAllAlphaZero()
{
gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", 0);
}
public void setMegaShape(MegaShapeArc msa) public void setMegaShape(MegaShapeArc msa)
{ {
m_kShapeArc = msa; m_kShapeArc = msa;
...@@ -170,4 +164,3 @@ public class AnimUnit : MonoBehaviour ...@@ -170,4 +164,3 @@ public class AnimUnit : MonoBehaviour
m_fAccumAnimOffset = val; m_fAccumAnimOffset = val;
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class LoopMegaCtrl : MonoBehaviour { 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 // Use this for initialization
private float m_offsetZ; private float m_offsetZ;
private float m_offsetpercent;
private float m_pathLenth; private float m_pathLenth;
public GameObject Path = null;
float m_ObjectLenth; private void Start()
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 //物体长度 --CardGame
m_ObjectLenth = 0.9f*0.02f; m_ObjectLenth = 0.9f * 0.02f;
//this.GetComponent<MegaWorldPathDeform>().animate = false; //this.GetComponent<MegaWorldPathDeform>().animate = false;
//this.GetComponent<MegaWorldPathDeform>().percent = 0; //this.GetComponent<MegaWorldPathDeform>().percent = 0;
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
{
} }
void LateUpdate() private void LateUpdate()
{ {
LoopMegaAntmation(); LoopMegaAntmation();
} }
void LoopMegaAntmation() private void LoopMegaAntmation()
{ {
//if(m_offsetZ>0) //if(m_offsetZ>0)
//{ //{
//获得线段长度 --CardGame //获得线段长度 --CardGame
if(m_bneedtoFollow && m_kFirstOb!=null ) if (m_bneedtoFollow && m_kFirstOb != null)
{ {
this.GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent; GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = false; m_bneedtoFollow = false;
} }
...@@ -51,8 +51,7 @@ public class LoopMegaCtrl : MonoBehaviour { ...@@ -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) // if(m_fBeforeLenth>m_pathLenth)
// { // {
...@@ -72,34 +71,28 @@ public class LoopMegaCtrl : MonoBehaviour { ...@@ -72,34 +71,28 @@ public class LoopMegaCtrl : MonoBehaviour {
// } // }
m_fBeforeLenth = m_pathLenth; m_fBeforeLenth = m_pathLenth;
m_offsetZ = -this.GetComponent<MegaWorldPathDeform>().Offset.z; m_offsetZ = -GetComponent<MegaWorldPathDeform>().Offset.z;
m_offsetpercent = ((m_ObjectLenth + m_offsetZ)/m_pathLenth)*100; m_offsetpercent = (m_ObjectLenth + m_offsetZ) / m_pathLenth * 100;
//Debug.Log(this.name+":" + m_offsetpercent); //Debug.Log(this.name+":" + m_offsetpercent);
this.GetComponent<MegaWorldPathDeform>().path = Path.GetComponent<MegaShapeArc>(); GetComponent<MegaWorldPathDeform>().path = Path.GetComponent<MegaShapeArc>();
if(this.GetComponent<MegaWorldPathDeform>().percent >= 100+m_offsetpercent) if (GetComponent<MegaWorldPathDeform>().percent >= 100 + m_offsetpercent)
{ {
//调整位置方法 --CardGame //调整位置方法 --CardGame
if(m_kFirstOb!=null) if (m_kFirstOb != null)
{ {
Debug.Log ("else follow first"); Debug.Log("else follow first");
this.GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent; GetComponent<MegaWorldPathDeform>().percent = m_kFirstOb.GetComponent<MegaWorldPathDeform>().percent;
m_bneedtoFollow = true; m_bneedtoFollow = true;
} }
else else
{ {
Debug.Log ("first to 0"); Debug.Log("first to 0");
this.GetComponent<MegaWorldPathDeform>().percent = 0; GetComponent<MegaWorldPathDeform>().percent = 0;
} }
} }
} }
......
 using System.Collections.Generic;
using UnityEngine; using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class LoopPathAnim : MonoBehaviour public class LoopPathAnim : MonoBehaviour
{ {
// public GameObject m_kStartObject = null;
// public GameObject m_kEndObject = null;
private MegaShapeArc m_kShapeArc = null;
public List<MegaWorldPathDeform> m_kMWPD_List = public List<MegaWorldPathDeform> m_kMWPD_List =
new List<MegaWorldPathDeform>(); new List<MegaWorldPathDeform>();
public float m_fOffsetValueStep = 1.0f; public float m_fOffsetValueStep = 1.0f;
// public GameObject m_kStartObject = null;
// public GameObject m_kEndObject = null;
void Start () private MegaShapeArc m_kShapeArc;
private void Start()
{ {
m_kShapeArc = GetComponent<MegaShapeArc> (); m_kShapeArc = GetComponent<MegaShapeArc>();
// m_kStartObject.transform.position = m_kShapeArc.splines [0].knots [0].p; // m_kStartObject.transform.position = m_kShapeArc.splines [0].knots [0].p;
// m_kEndObject.transform.position = // m_kEndObject.transform.position =
// m_kShapeArc.splines [0].knots[ m_kShapeArc.splines [0].knots.Count-1 ].p; // m_kShapeArc.splines [0].knots[ m_kShapeArc.splines [0].knots.Count-1 ].p;
foreach(MegaWorldPathDeform iter in m_kMWPD_List) foreach (var iter in m_kMWPD_List)
{ if (iter.GetComponent<AnimUnit>())
if( iter.GetComponent<AnimUnit>() )
{
iter.GetComponent<AnimUnit>().setMegaShape(m_kShapeArc); iter.GetComponent<AnimUnit>().setMegaShape(m_kShapeArc);
//Debug.Log("set shaps..."); //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 [0].p = m_kStartObject.transform.position;
// //
...@@ -59,18 +48,14 @@ public class LoopPathAnim : MonoBehaviour ...@@ -59,18 +48,14 @@ public class LoopPathAnim : MonoBehaviour
//添加到箭头组成尾部 --CardGame //添加到箭头组成尾部 --CardGame
public void moveToTail(MegaWorldPathDeform mwpd) public void moveToTail(MegaWorldPathDeform mwpd)
{ {
if( m_kMWPD_List.Contains(mwpd) ) if (m_kMWPD_List.Contains(mwpd))
{ {
float val = var val =
m_kMWPD_List[m_kMWPD_List.Count-1]. m_kMWPD_List[m_kMWPD_List.Count - 1].GetComponent<AnimUnit>().getAccumOffset() + m_fOffsetValueStep;
GetComponent<AnimUnit>().getAccumOffset() + m_fOffsetValueStep;
mwpd.GetComponent<AnimUnit>().setAccumOffset(val); mwpd.GetComponent<AnimUnit>().setAccumOffset(val);
m_kMWPD_List.Remove(mwpd); m_kMWPD_List.Remove(mwpd);
m_kMWPD_List.Add(mwpd); m_kMWPD_List.Add(mwpd);
} }
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class RendMega : MonoBehaviour {
public class RendMega : MonoBehaviour
{
public Vector3 StartPosition = Vector3.zero; public Vector3 StartPosition = Vector3.zero;
public Vector3 FingerPosition = Vector3.zero; public Vector3 FingerPosition = Vector3.zero;
public Transform SkillPosition = null; public Transform SkillPosition;
public Transform SkillPositionForm = null; public Transform SkillPositionForm;
public GameObject m_kPath = null; public GameObject m_kPath;
public float k = 3f; public float k = 3f;
// Use this for initialization // Use this for initialization
void Start () { private void Start()
{
} }
// Update is called once per frame // Update is called once per frame
void Update() private void Update()
{ {
MyRenderPath(); MyRenderPath();
} }
public void MyRenderPath() public void MyRenderPath()
{ {
m_kPath.transform.localScale = new Vector3(k, k, k); m_kPath.transform.localScale = new Vector3(k, k, k);
Vector3 v3FromPos = SkillPosition.position/k; var v3FromPos = SkillPosition.position / k;
Vector3 v3TargetPos = SkillPositionForm.position/k; var v3TargetPos = SkillPositionForm.position / k;
Vector3 v3MidPos = (v3FromPos + v3TargetPos)/2; var v3MidPos = (v3FromPos + v3TargetPos) / 2;
v3MidPos += new Vector3(0, Vector3.Distance(v3TargetPos, v3FromPos) / 10f * 3f, 0); v3MidPos += new Vector3(0, Vector3.Distance(v3TargetPos, v3FromPos) / 10f * 3f, 0);
v3MidPos += (v3TargetPos - v3FromPos) / 10f * 3f; 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+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) ;
Vector3 v3TarGetAnchorIn = v3TargetPos + new Vector3(0, (v3MidPos.y / 3), 0) - V3Midvect/10; var v3TarGetAnchorIn = v3TargetPos + new Vector3(0, v3MidPos.y / 3, 0) - V3Midvect / 10;
Vector3 v3TarGetAnchorOut = v3TargetPos + new Vector3(0, -(v3MidPos.y / 3), 0); 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 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() public void AllAlphaZero()
{ {
for(int i = 0;i<m_karrow.Length;i++) for (var i = 0; i < m_karrow.Length; i++)
{ if (m_karrow[i].GetComponent<AnimUnit>() != null)
if(m_karrow[i].GetComponent<AnimUnit>()!=null)
{
m_karrow[i].GetComponent<AnimUnit>().SetAllAlphaZero(); m_karrow[i].GetComponent<AnimUnit>().SetAllAlphaZero();
} }
}
}
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class blinding : MonoBehaviour {
public class blinding : MonoBehaviour
{
// Use this for initialization // Use this for initialization
void Start () { private void Start()
{
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
this.gameObject.GetComponent<Renderer>().material.SetFloat("_Alpha", (1f + Mathf.Sin(Time.time*10)) / 2f); {
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 UnityEngine;
using System.Collections;
public class arrow : MonoBehaviour { public class arrow : MonoBehaviour
{
public float speed = 1; public float speed = 1;
public Transform from; public Transform from;
public Transform to; public Transform to;
public RendMega mega; public RendMega mega;
public MegaShapeArc arc; public MegaShapeArc arc;
// Use this for initialization // Use this for initialization
void Start () private void Start()
{ {
updateSpeed(); updateSpeed();
} }
public void updateSpeed() // Update is called once per frame
{ private void Update()
var list = GetComponentsInChildren<AnimUnit>();
foreach (var item in list)
{ {
item.m_fspeed = speed;
} }
}
// Update is called once per frame
void Update () {
public void updateSpeed()
{
var list = GetComponentsInChildren<AnimUnit>();
foreach (var item in list) item.m_fspeed = speed;
} }
} }
\ No newline at end of file
 using UnityEngine;
using UnityEngine;
using System.Collections;
//设置在编辑模式下也执行该脚本 //设置在编辑模式下也执行该脚本
[ExecuteInEditMode] [ExecuteInEditMode]
...@@ -8,11 +6,32 @@ using System.Collections; ...@@ -8,11 +6,32 @@ using System.Collections;
[AddComponentMenu("Learning Unity Shader/Lecture 15/RapidBlurEffect")] [AddComponentMenu("Learning Unity Shader/Lecture 15/RapidBlurEffect")]
public class RapidBlurEffect : MonoBehaviour 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 #region Variables
//指定Shader名称 //指定Shader名称
private string ShaderName = "Learning Unity Shader/Lecture 15/RapidBlurEffect"; private readonly string ShaderName = "Learning Unity Shader/Lecture 15/RapidBlurEffect";
//着色器和材质实例 //着色器和材质实例
public Shader CurShader; public Shader CurShader;
...@@ -24,38 +43,25 @@ public class RapidBlurEffect : MonoBehaviour ...@@ -24,38 +43,25 @@ public class RapidBlurEffect : MonoBehaviour
public static int ChangeValue3; public static int ChangeValue3;
//降采样次数 //降采样次数
[Range(0, 6), Tooltip("[降采样次数]向下采样的次数。此值越大,则采样间隔越大,需要处理的像素点越少,运行速度越快。")] [Range(0, 6)] [Tooltip("[降采样次数]向下采样的次数。此值越大,则采样间隔越大,需要处理的像素点越少,运行速度越快。")]
public int DownSampleNum = 2; public int DownSampleNum = 2;
//模糊扩散度 //模糊扩散度
[Range(0.0f, 20.0f), Tooltip("[模糊扩散度]进行高斯模糊时,相邻像素点的间隔。此值越大相邻像素间隔越远,图像越模糊。但过大的值会导致失真。")] [Range(0.0f, 20.0f)] [Tooltip("[模糊扩散度]进行高斯模糊时,相邻像素点的间隔。此值越大相邻像素间隔越远,图像越模糊。但过大的值会导致失真。")]
public float BlurSpreadSize = 3.0f; public float BlurSpreadSize = 3.0f;
//迭代次数 //迭代次数
[Range(0, 8), Tooltip("[迭代次数]此值越大,则模糊操作的迭代次数越多,模糊效果越好,但消耗越大。")] [Range(0, 8)] [Tooltip("[迭代次数]此值越大,则模糊操作的迭代次数越多,模糊效果越好,但消耗越大。")]
public int BlurIterations = 3; public int BlurIterations = 3;
#endregion #endregion
//-------------------------材质的get&set----------------------------
#region MaterialGetAndSet
Material material
{
get
{
if (CurMaterial == null)
{
CurMaterial = new Material(CurShader);
CurMaterial.hideFlags = HideFlags.HideAndDontSave;
}
return CurMaterial;
}
}
#endregion
#region Functions #region Functions
//-----------------------------------------【Start()函数】--------------------------------------------- //-----------------------------------------【Start()函数】---------------------------------------------
// 说明:此函数仅在Update函数第一次被调用前被调用 // 说明:此函数仅在Update函数第一次被调用前被调用
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
void Start() private void Start()
{ {
//依次赋值 //依次赋值
ChangeValue = DownSampleNum; ChangeValue = DownSampleNum;
...@@ -69,49 +75,48 @@ public class RapidBlurEffect : MonoBehaviour ...@@ -69,49 +75,48 @@ public class RapidBlurEffect : MonoBehaviour
if (!SystemInfo.supportsImageEffects) if (!SystemInfo.supportsImageEffects)
{ {
enabled = false; enabled = false;
return;
} }
} }
//-------------------------------------【OnRenderImage()函数】------------------------------------ //-------------------------------------【OnRenderImage()函数】------------------------------------
// 说明:此函数在当完成所有渲染图片后被调用,用来渲染图片后期效果 // 说明:此函数在当完成所有渲染图片后被调用,用来渲染图片后期效果
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture) private void OnRenderImage(RenderTexture sourceTexture, RenderTexture destTexture)
{ {
//着色器实例不为空,就进行参数设置 //着色器实例不为空,就进行参数设置
if (CurShader != null) if (CurShader != null)
{ {
//【0】参数准备 //【0】参数准备
//根据向下采样的次数确定宽度系数。用于控制降采样后相邻像素的间隔 //根据向下采样的次数确定宽度系数。用于控制降采样后相邻像素的间隔
float widthMod = 1.0f / (1.0f * (1 << DownSampleNum)); var widthMod = 1.0f / (1.0f * (1 << DownSampleNum));
//Shader的降采样参数赋值 //Shader的降采样参数赋值
material.SetFloat("_DownSampleValue", BlurSpreadSize * widthMod); material.SetFloat("_DownSampleValue", BlurSpreadSize * widthMod);
//设置渲染模式:双线性 //设置渲染模式:双线性
sourceTexture.filterMode = FilterMode.Bilinear; sourceTexture.filterMode = FilterMode.Bilinear;
//通过右移,准备长、宽参数值 //通过右移,准备长、宽参数值
int renderWidth = sourceTexture.width >> DownSampleNum; var renderWidth = sourceTexture.width >> DownSampleNum;
int renderHeight = sourceTexture.height >> DownSampleNum; var renderHeight = sourceTexture.height >> DownSampleNum;
// 【1】处理Shader的通道0,用于降采样 ||Pass 0,for down sample // 【1】处理Shader的通道0,用于降采样 ||Pass 0,for down sample
//准备一个缓存renderBuffer,用于准备存放最终数据 //准备一个缓存renderBuffer,用于准备存放最终数据
RenderTexture renderBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format); var renderBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
//设置渲染模式:双线性 //设置渲染模式:双线性
renderBuffer.filterMode = FilterMode.Bilinear; renderBuffer.filterMode = FilterMode.Bilinear;
//拷贝sourceTexture中的渲染数据到renderBuffer,并仅绘制指定的pass0的纹理数据 //拷贝sourceTexture中的渲染数据到renderBuffer,并仅绘制指定的pass0的纹理数据
Graphics.Blit(sourceTexture, renderBuffer, material, 0); Graphics.Blit(sourceTexture, renderBuffer, material, 0);
//【2】根据BlurIterations(迭代次数),来进行指定次数的迭代操作 //【2】根据BlurIterations(迭代次数),来进行指定次数的迭代操作
for (int i = 0; i < BlurIterations; i++) for (var i = 0; i < BlurIterations; i++)
{ {
//【2.1】Shader参数赋值 //【2.1】Shader参数赋值
//迭代偏移量参数 //迭代偏移量参数
float iterationOffs = (i * 1.0f); var iterationOffs = i * 1.0f;
//Shader的降采样参数赋值 //Shader的降采样参数赋值
material.SetFloat("_DownSampleValue", BlurSpreadSize * widthMod + iterationOffs); material.SetFloat("_DownSampleValue", BlurSpreadSize * widthMod + iterationOffs);
// 【2.2】处理Shader的通道1,垂直方向模糊处理 || Pass1,for vertical blur // 【2.2】处理Shader的通道1,垂直方向模糊处理 || Pass1,for vertical blur
// 定义一个临时渲染的缓存tempBuffer // 定义一个临时渲染的缓存tempBuffer
RenderTexture tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format); var tempBuffer = RenderTexture.GetTemporary(renderWidth, renderHeight, 0, sourceTexture.format);
// 拷贝renderBuffer中的渲染数据到tempBuffer,并仅绘制指定的pass1的纹理数据 // 拷贝renderBuffer中的渲染数据到tempBuffer,并仅绘制指定的pass1的纹理数据
Graphics.Blit(renderBuffer, tempBuffer, material, 1); Graphics.Blit(renderBuffer, tempBuffer, material, 1);
// 清空renderBuffer // 清空renderBuffer
...@@ -136,7 +141,6 @@ public class RapidBlurEffect : MonoBehaviour ...@@ -136,7 +141,6 @@ public class RapidBlurEffect : MonoBehaviour
Graphics.Blit(renderBuffer, destTexture); Graphics.Blit(renderBuffer, destTexture);
//清空renderBuffer //清空renderBuffer
RenderTexture.ReleaseTemporary(renderBuffer); RenderTexture.ReleaseTemporary(renderBuffer);
} }
//着色器实例为空,直接拷贝屏幕上的效果。此情况下是没有实现屏幕特效的 //着色器实例为空,直接拷贝屏幕上的效果。此情况下是没有实现屏幕特效的
...@@ -151,7 +155,7 @@ public class RapidBlurEffect : MonoBehaviour ...@@ -151,7 +155,7 @@ public class RapidBlurEffect : MonoBehaviour
//-----------------------------------------【OnValidate()函数】-------------------------------------- //-----------------------------------------【OnValidate()函数】--------------------------------------
// 说明:此函数在编辑器中该脚本的某个值发生了改变后被调用 // 说明:此函数在编辑器中该脚本的某个值发生了改变后被调用
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
void OnValidate() private void OnValidate()
{ {
//将编辑器中的值赋值回来,确保在编辑器中值的改变立刻让结果生效 //将编辑器中的值赋值回来,确保在编辑器中值的改变立刻让结果生效
ChangeValue = DownSampleNum; ChangeValue = DownSampleNum;
...@@ -162,7 +166,7 @@ public class RapidBlurEffect : MonoBehaviour ...@@ -162,7 +166,7 @@ public class RapidBlurEffect : MonoBehaviour
//-----------------------------------------【Update()函数】-------------------------------------- //-----------------------------------------【Update()函数】--------------------------------------
// 说明:此函数每帧都会被调用 // 说明:此函数每帧都会被调用
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
void Update() private void Update()
{ {
//若程序在运行,进行赋值 //若程序在运行,进行赋值
if (Application.isPlaying) if (Application.isPlaying)
...@@ -174,27 +178,19 @@ public class RapidBlurEffect : MonoBehaviour ...@@ -174,27 +178,19 @@ public class RapidBlurEffect : MonoBehaviour
} }
//若程序没有在运行,去寻找对应的Shader文件 //若程序没有在运行,去寻找对应的Shader文件
#if UNITY_EDITOR #if UNITY_EDITOR
if (Application.isPlaying != true) if (Application.isPlaying != true) CurShader = Shader.Find(ShaderName);
{
CurShader = Shader.Find(ShaderName);
}
#endif #endif
} }
//-----------------------------------------【OnDisable()函数】--------------------------------------- //-----------------------------------------【OnDisable()函数】---------------------------------------
// 说明:当对象变为不可用或非激活状态时此函数便被调用 // 说明:当对象变为不可用或非激活状态时此函数便被调用
//-------------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------------
void OnDisable() private void OnDisable()
{ {
if (CurMaterial) if (CurMaterial)
{
//立即销毁材质实例 //立即销毁材质实例
DestroyImmediate(CurMaterial); DestroyImmediate(CurMaterial);
} }
}
#endregion #endregion
} }
\ No newline at end of file
using UnityEngine; using System;
using System.Collections; using UnityEngine;
public class UImouseHint : MonoBehaviour { public class UImouseHint : MonoBehaviour
{
public GameObject point; public GameObject point;
public Camera cam; public Camera cam;
private bool drag;
// Use this for initialization // Use this for initialization
void Start () { private void Start()
{
try try
{ {
cam = gameObject.transform.GetComponentInParent<UIRoot>().GetComponentInChildren<Camera>(); cam = gameObject.transform.GetComponentInParent<UIRoot>().GetComponentInChildren<Camera>();
} }
catch (System.Exception) catch (Exception)
{ {
} }
} }
// Update is called once per frame // Update is called once per frame
void Update() private void Update()
{ {
if (drag) if (drag)
{
point.transform.position = cam.ScreenToWorldPoint(new Vector3( point.transform.position = cam.ScreenToWorldPoint(new Vector3(
Input.mousePosition.x+5, Input.mousePosition.x + 5,
Input.mousePosition.y-25,0 Input.mousePosition.y - 25, 0
)); ));
} }
}
bool drag = false;
public void begin() public void begin()
{ {
drag = true; drag = true;
......
using UnityEngine; using TMPro;
using System; using UnityEngine;
public class chainMono : MonoBehaviour { public class chainMono : MonoBehaviour
{
public Renderer circle; public Renderer circle;
public TMPro.TextMeshPro text; public TextMeshPro text;
public bool flashing = true; public bool flashing = true;
float all = 0; private float all;
bool p = true; private bool p = true;
void Update()
private void Update()
{ {
if (flashing) if (flashing)
{ {
all += Program.deltaTime; all += Program.deltaTime;
if (all>0.05) if (all > 0.05)
{ {
all = 0; all = 0;
p = !p; p = !p;
......
using UnityEngine; using UnityEditor;
using UnityEditor; using UnityEngine;
using System.Collections;
using System.Collections.Generic;
[CustomEditor(typeof(ParticleScale))] [CustomEditor(typeof(ParticleScale))]
public class ParticleScaleEditor : Editor { public class ParticleScaleEditor : Editor
{
public ParticleScale tgt => target as ParticleScale;
void Awake() { private void Awake()
{
foreach(Transform tr in tgt.transform) { foreach (Transform tr in tgt.transform)
if(tr.gameObject.GetComponent<ParticleScale>() == null) { if (tr.gameObject.GetComponent<ParticleScale>() == null)
tr.gameObject.AddComponent<ParticleScale>(); tr.gameObject.AddComponent<ParticleScale>();
} }
}
}
public override void OnInspectorGUI()
{
public override void OnInspectorGUI() {
tgt.scaleStep = EditorGUILayout.FloatField("Scale Step", tgt.scaleStep); tgt.scaleStep = EditorGUILayout.FloatField("Scale Step", tgt.scaleStep);
...@@ -33,55 +24,36 @@ public class ParticleScaleEditor : Editor { ...@@ -33,55 +24,36 @@ public class ParticleScaleEditor : Editor {
GUILayout.FlexibleSpace(); GUILayout.FlexibleSpace();
if (GUILayout.Button(new GUIContent("Scale Up"), GUILayout.Width(80))) UpdateScale(tgt.scaleStep);
if(GUILayout.Button(new GUIContent("Scale Up"), GUILayout.Width(80))) { if (GUILayout.Button(new GUIContent("Scale Down"), GUILayout.Width(80))) ReduceScale(tgt.scaleStep);
UpdateScale(tgt.scaleStep);
}
if(GUILayout.Button(new GUIContent("Scale Down"), GUILayout.Width(80))) {
ReduceScale(tgt.scaleStep);
}
EditorGUILayout.EndHorizontal(); EditorGUILayout.EndHorizontal();
EditorGUILayout.Separator(); EditorGUILayout.Separator();
} }
private void UpdateScale(float mod) { private void UpdateScale(float mod)
{
tgt.UpdateScale(mod); tgt.UpdateScale(mod);
foreach(Transform tr in tgt.transform) { foreach (Transform tr in tgt.transform)
if(tr.gameObject.GetComponent<ParticleScale>() == null) { {
tr.gameObject.AddComponent<ParticleScale>(); if (tr.gameObject.GetComponent<ParticleScale>() == null) tr.gameObject.AddComponent<ParticleScale>();
}
tr.gameObject.GetComponent<ParticleScale>().UpdateScale(mod); tr.gameObject.GetComponent<ParticleScale>().UpdateScale(mod);
} }
} }
private void ReduceScale(float mod) { private void ReduceScale(float mod)
{
tgt.ReduceScale(mod); tgt.ReduceScale(mod);
foreach(Transform tr in tgt.transform) { foreach (Transform tr in tgt.transform)
if(tr.gameObject.GetComponent<ParticleScale>() == null) { {
tr.gameObject.AddComponent<ParticleScale>(); if (tr.gameObject.GetComponent<ParticleScale>() == null) tr.gameObject.AddComponent<ParticleScale>();
}
tr.gameObject.GetComponent<ParticleScale>().ReduceScale(mod); tr.gameObject.GetComponent<ParticleScale>().ReduceScale(mod);
} }
} }
public ParticleScale tgt {
get {
return target as ParticleScale;
}
}
} }
\ No newline at end of file
using UnityEngine; 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 = null; private ParticleSystem _particle;
public void UpdateScale(float mod) { public ParticleSystem particle
{
get
{
if (_particle == null) _particle = GetComponent<ParticleSystem>();
if(particle == null) { return _particle;
return; }
} }
public void UpdateScale(float mod)
{
if (particle == null) return;
particle.startSize = particle.startSize + particle.startSize * mod; particle.startSize = particle.startSize + particle.startSize * mod;
particle.startSpeed = particle.startSpeed + particle.startSpeed * mod; particle.startSpeed = particle.startSpeed + particle.startSpeed * mod;
} }
public void ReduceScale(float mod) { public void ReduceScale(float mod)
{
if(particle == null) { if (particle == null) return;
return;
}
particle.startSize = particle.startSize - particle.startSize * mod; particle.startSize = particle.startSize - particle.startSize * mod;
particle.startSpeed = particle.startSpeed - particle.startSpeed * mod; particle.startSpeed = particle.startSpeed - particle.startSpeed * mod;
}
public ParticleSystem particle {
get {
if(_particle == null) {
_particle = GetComponent<ParticleSystem>();
}
return _particle;
}
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class Galaxy_Rotation_01 : MonoBehaviour {
public class Galaxy_Rotation_01 : MonoBehaviour
{
// Use this for initialization // Use this for initialization
void Start () { private void Start()
{
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
{
// Slowly rotate the object around its X axis at 1 degree/second. // Slowly rotate the object around its X axis at 1 degree/second.
transform.Rotate(Vector3.forward * Time.deltaTime*-10); transform.Rotate(Vector3.forward * Time.deltaTime * -10);
} }
} }
\ No newline at end of file
using UnityEngine; using DG.Tweening;
using System.Collections; using UnityEngine;
using System; using YGOSharp;
using DG.Tweening;
public class MonoCardInDeckManager : MonoBehaviour { public class MonoCardInDeckManager : MonoBehaviour
int loadedPicCode = 0; {
YGOSharp.Banlist loaded_banlist = null; public bool dying;
public bool dying = false;
bool died = false;
public YGOSharp.Card cardData=new YGOSharp.Card();
void Update () 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) 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) if (pic != null)
{ {
loadedPicCode = cardData.Id; loadedPicCode = cardData.Id;
gameObject.transform.Find("face").GetComponent<Renderer>().material.mainTexture = pic; gameObject.transform.Find("face").GetComponent<Renderer>().material.mainTexture = pic;
} }
} }
if (Program.I().deckManager.currentBanlist != loaded_banlist) if (Program.I().deckManager.currentBanlist != loaded_banlist)
{ {
ban_icon ico = GetComponentInChildren<ban_icon>(); var ico = GetComponentInChildren<ban_icon>();
loaded_banlist = Program.I().deckManager.currentBanlist; loaded_banlist = Program.I().deckManager.currentBanlist;
if (loaded_banlist != null) if (loaded_banlist != null)
{
ico.show(loaded_banlist.GetQuantity(cardData.Id)); ico.show(loaded_banlist.GetQuantity(cardData.Id));
}
else else
{
ico.show(3); ico.show(3);
} }
}
if (isDraging) if (isDraging) gameObject.transform.position += (getGoodPosition(4) - gameObject.transform.position) * 0.3f;
{ if (Vector3.Distance(Vector3.zero, gameObject.transform.position) > 50 && bool_physicalON) killIt();
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() public void killIt()
...@@ -50,15 +46,9 @@ public class MonoCardInDeckManager : MonoBehaviour { ...@@ -50,15 +46,9 @@ public class MonoCardInDeckManager : MonoBehaviour {
{ {
gameObject.transform.position = new Vector3(0, 5, 0); gameObject.transform.position = new Vector3(0, 5, 0);
endDrag(); endDrag();
if (Program.I().deckManager.cardInDragging==this) if (Program.I().deckManager.cardInDragging == this) Program.I().deckManager.cardInDragging = null;
{ var rigidbody = GetComponent<Rigidbody>();
Program.I().deckManager.cardInDragging = null; if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
}
Rigidbody rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null)
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
rigidbody.Sleep(); rigidbody.Sleep();
} }
else else
...@@ -71,22 +61,20 @@ public class MonoCardInDeckManager : MonoBehaviour { ...@@ -71,22 +61,20 @@ public class MonoCardInDeckManager : MonoBehaviour {
public Vector3 getGoodPosition(float height) public Vector3 getGoodPosition(float height)
{ {
float x = Input.mousePosition.x; var x = Input.mousePosition.x;
float y = Input.mousePosition.y; var y = Input.mousePosition.y;
Vector3 to_ltemp = Program.I().main_camera.ScreenToWorldPoint(new Vector3(x, y, 1)); var to_ltemp = Program.I().main_camera.ScreenToWorldPoint(new Vector3(x, y, 1));
Vector3 dv = to_ltemp - Program.I().main_camera.transform.position; var dv = to_ltemp - Program.I().main_camera.transform.position;
if (dv.y == 0) dv.y = 0.01f; if (dv.y == 0) dv.y = 0.01f;
to_ltemp.x = ((height - Program.I().main_camera.transform.position.y) to_ltemp.x = (height - Program.I().main_camera.transform.position.y)
* (dv.x) / dv.y + Program.I().main_camera.transform.position.x); * dv.x / dv.y + Program.I().main_camera.transform.position.x;
to_ltemp.y = ((height - Program.I().main_camera.transform.position.y) to_ltemp.y = (height - Program.I().main_camera.transform.position.y)
* (dv.y) / dv.y + 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) to_ltemp.z = (height - Program.I().main_camera.transform.position.y)
* (dv.z) / dv.y + Program.I().main_camera.transform.position.z); * dv.z / dv.y + Program.I().main_camera.transform.position.z;
return to_ltemp; return to_ltemp;
} }
bool isDraging = false;
public void beginDrag() public void beginDrag()
{ {
physicalOFF(); physicalOFF();
...@@ -101,21 +89,18 @@ public class MonoCardInDeckManager : MonoBehaviour { ...@@ -101,21 +89,18 @@ public class MonoCardInDeckManager : MonoBehaviour {
isDraging = false; isDraging = false;
if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || getIfAlive() == false) if (Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl) || getIfAlive() == false)
{ {
Vector3 form_position = getGoodPosition(4); var form_position = getGoodPosition(4);
Vector3 to_position = getGoodPosition(0); var to_position = getGoodPosition(0);
Vector3 delta_position = to_position - form_position; var delta_position = to_position - form_position;
GetComponent<Rigidbody>().AddForce(delta_position * 1000); GetComponent<Rigidbody>().AddForce(delta_position * 1000);
dying = true; 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.DOMove(position, 0.2f).OnComplete(physicalON);
transform.DORotate(rotation, 0.15f); transform.DORotate(rotation, 0.15f);
...@@ -137,17 +122,12 @@ public class MonoCardInDeckManager : MonoBehaviour { ...@@ -137,17 +122,12 @@ public class MonoCardInDeckManager : MonoBehaviour {
physicalOFF(); physicalOFF();
} }
bool bool_physicalON = false;
private void physicalON() private void physicalON()
{ {
bool_physicalON = true; bool_physicalON = true;
GetComponent<BoxCollider>().enabled = true; GetComponent<BoxCollider>().enabled = true;
Rigidbody rigidbody = GetComponent<Rigidbody>(); var rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null) if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
rigidbody.Sleep(); rigidbody.Sleep();
rigidbody.useGravity = true; rigidbody.useGravity = true;
rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
...@@ -157,11 +137,8 @@ public class MonoCardInDeckManager : MonoBehaviour { ...@@ -157,11 +137,8 @@ public class MonoCardInDeckManager : MonoBehaviour {
{ {
bool_physicalON = false; bool_physicalON = false;
GetComponent<BoxCollider>().enabled = true; GetComponent<BoxCollider>().enabled = true;
Rigidbody rigidbody = GetComponent<Rigidbody>(); var rigidbody = GetComponent<Rigidbody>();
if (rigidbody == null) if (rigidbody == null) rigidbody = gameObject.AddComponent<Rigidbody>();
{
rigidbody = gameObject.AddComponent<Rigidbody>();
}
rigidbody.useGravity = false; rigidbody.useGravity = false;
rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic; rigidbody.collisionDetectionMode = CollisionDetectionMode.ContinuousDynamic;
} }
...@@ -170,46 +147,34 @@ public class MonoCardInDeckManager : MonoBehaviour { ...@@ -170,46 +147,34 @@ public class MonoCardInDeckManager : MonoBehaviour {
{ {
bool_physicalON = false; bool_physicalON = false;
GetComponent<BoxCollider>().enabled = false; GetComponent<BoxCollider>().enabled = false;
Rigidbody rigidbody = GetComponent<Rigidbody>(); var rigidbody = GetComponent<Rigidbody>();
if (rigidbody != null) if (rigidbody != null) rigidbody.useGravity = false;
{
rigidbody.useGravity = false;
}
} }
public bool getIfAlive() public bool getIfAlive()
{ {
bool ret = true; var ret = true;
if (died == true) if (died) ret = false;
{ if (gameObject.transform.position.y < -0.5f) ret = false;
ret = false; var to_ltemp = refLectPosition(gameObject.transform.position);
}
if (gameObject.transform.position.y < -0.5f)
{
ret = false;
}
Vector3 to_ltemp = refLectPosition(gameObject.transform.position);
if (to_ltemp.x < -15.2f) ret = false; if (to_ltemp.x < -15.2f) ret = false;
if (to_ltemp.x > 15.2f) ret = false; if (to_ltemp.x > 15.2f) ret = false;
if (Program.I().deckManager.condition == DeckManager.Condition.changeSide) if (Program.I().deckManager.condition == DeckManager.Condition.changeSide) ret = true;
{
ret = true;
}
return ret; return ret;
} }
public static Vector3 refLectPosition(Vector3 pos) public static Vector3 refLectPosition(Vector3 pos)
{ {
Vector3 to_ltemp = pos; var to_ltemp = pos;
Vector3 dv = to_ltemp - Program.I().main_camera.transform.position; var dv = to_ltemp - Program.I().main_camera.transform.position;
if (dv.y == 0) dv.y = 0.01f; if (dv.y == 0) dv.y = 0.01f;
to_ltemp.x = ((0 - Program.I().main_camera.transform.position.y) to_ltemp.x = (0 - Program.I().main_camera.transform.position.y)
* (dv.x) / dv.y + Program.I().main_camera.transform.position.x); * dv.x / dv.y + Program.I().main_camera.transform.position.x;
to_ltemp.y = ((0 - Program.I().main_camera.transform.position.y) to_ltemp.y = (0 - Program.I().main_camera.transform.position.y)
* (dv.y) / dv.y + 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) to_ltemp.z = (0 - Program.I().main_camera.transform.position.y)
* (dv.z) / dv.y + Program.I().main_camera.transform.position.z); * dv.z / dv.y + Program.I().main_camera.transform.position.z;
return to_ltemp; return to_ltemp;
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections; using YGOSharp;
public class cardPicLoader : MonoBehaviour public class cardPicLoader : MonoBehaviour
{ {
public int loaded_code = -1; public int loaded_code = -1;
public int code = 0; public int code;
public YGOSharp.Banlist loaded_banlist = null;
public Texture2D defaults = null; public Texture2D defaults;
public ban_icon ico; public ban_icon ico;
public void clear() public Collider coli;
{
loaded_code = 0;
code = 0;
ico.show(3);
uiTexture.mainTexture = null;
}
public void reCode(int c) public UITexture uiTexture;
{
loaded_code = 0;
code = c;
}
public void relayer(int l) public Banlist loaded_banlist;
{
uiTexture.depth = 50 + l * 2;
UITexture t = ico.gameObject.GetComponent<UITexture>();
t.depth = 51 + l * 2;
}
public Collider coli = null; public Card data { get; set; }
void Update() private void Update()
{ {
if (coli != null) if (coli != null)
{
if (Program.InputGetMouseButtonDown_0) if (Program.InputGetMouseButtonDown_0)
{
if (Program.pointedCollider == coli) if (Program.pointedCollider == coli)
{ Program.I().cardDescription.setData(CardsManager.Get(code), GameTextureManager.myBack, "", true);
((CardDescription)(Program.I().cardDescription)).setData(YGOSharp.CardsManager.Get(code), GameTextureManager.myBack,"",true);
}
}
}
if (Program.I().deckManager != null) if (Program.I().deckManager != null)
{ {
if (loaded_code != code) 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) if (t != null)
{ {
uiTexture.mainTexture = t; uiTexture.mainTexture = t;
uiTexture.aspectRatio = ((float)t.width) / ((float)t.height); uiTexture.aspectRatio = t.width / (float) t.height;
uiTexture.forceWidth((int)(uiTexture.height * uiTexture.aspectRatio)); uiTexture.forceWidth((int) (uiTexture.height * uiTexture.aspectRatio));
loaded_code = code; loaded_code = code;
loaded_banlist = null; loaded_banlist = null;
} }
} }
if (loaded_banlist != Program.I().deckManager.currentBanlist) if (loaded_banlist != Program.I().deckManager.currentBanlist)
{ {
loaded_banlist = Program.I().deckManager.currentBanlist; loaded_banlist = Program.I().deckManager.currentBanlist;
...@@ -73,13 +50,31 @@ public class cardPicLoader : MonoBehaviour ...@@ -73,13 +50,31 @@ public class cardPicLoader : MonoBehaviour
ico.show(3); ico.show(3);
return; return;
} }
ico.show(loaded_banlist.GetQuantity(code)); 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 UnityEngine;
using System.Collections;
public class descKeeper : MonoBehaviour { public class descKeeper : MonoBehaviour
{
public UITexture card; public UITexture card;
public UITexture back; public UITexture back;
// Use this for initialization // Use this for initialization
void Start() private void Start()
{ {
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
if (back.width < card.width)
{ {
back.width = card.width + 2; if (back.width < card.width) back.width = card.width + 2;
}
back.transform.localPosition = new Vector3(back.width / 2f, 0); 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); 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; Program.I().cardDescription.cHeight = card.height;
} }
} }
\ No newline at end of file
using UnityEngine; using System;
using System.Collections; using UnityEngine;
public class forceColor : MonoBehaviour {
public class forceColor : MonoBehaviour
{
// Use this for initialization // Use this for initialization
void Start () { private void Start()
var tweens = GetComponentsInChildren<TweenColor>();
foreach (var item in tweens)
{ {
DestroyImmediate(item); var tweens = GetComponentsInChildren<TweenColor>();
} foreach (var item in tweens) DestroyImmediate(item);
Color c; Color c;
ColorUtility.TryParseHtmlString(Config.Getui("allUI.color"), out c); ColorUtility.TryParseHtmlString(Config.Getui("allUI.color"), out c);
var sprites = GetComponentsInChildren<UISprite>(); var sprites = GetComponentsInChildren<UISprite>();
foreach (var item in sprites) foreach (var item in sprites)
{
if (item.color.a > 0.1f) if (item.color.a > 0.1f)
{ {
item.color = c; item.color = c;
...@@ -22,11 +19,11 @@ public class forceColor : MonoBehaviour { ...@@ -22,11 +19,11 @@ public class forceColor : MonoBehaviour {
{ {
item.gameObject.GetComponentInParent<UIButton>().defaultColor = c; item.gameObject.GetComponentInParent<UIButton>().defaultColor = c;
} }
catch (System.Exception) catch (Exception)
{ {
} }
} }
}
ColorUtility.TryParseHtmlString(Config.Getui("List.color"), out c); ColorUtility.TryParseHtmlString(Config.Getui("List.color"), out c);
var lists = GetComponentsInChildren<UIPopupList>(); var lists = GetComponentsInChildren<UIPopupList>();
foreach (var item in lists) foreach (var item in lists)
...@@ -37,10 +34,11 @@ public class forceColor : MonoBehaviour { ...@@ -37,10 +34,11 @@ public class forceColor : MonoBehaviour {
item.gameObject.GetComponent<UISprite>().color = c; item.gameObject.GetComponent<UISprite>().color = c;
item.gameObject.GetComponent<UIButton>().defaultColor = c; item.gameObject.GetComponent<UIButton>().defaultColor = c;
} }
catch (System.Exception) catch (Exception)
{ {
} }
} }
ColorUtility.TryParseHtmlString(Config.Getui("lable.color"), out c); ColorUtility.TryParseHtmlString(Config.Getui("lable.color"), out c);
var ls = GetComponentsInChildren<UILabel>(); var ls = GetComponentsInChildren<UILabel>();
foreach (var item in ls) foreach (var item in ls)
...@@ -49,16 +47,14 @@ public class forceColor : MonoBehaviour { ...@@ -49,16 +47,14 @@ public class forceColor : MonoBehaviour {
item.gradientTop = c; item.gradientTop = c;
item.gradientBottom = Color.gray; item.gradientBottom = Color.gray;
} }
ColorUtility.TryParseHtmlString(Config.Getui("lable.color.fadecolor"), out c); ColorUtility.TryParseHtmlString(Config.Getui("lable.color.fadecolor"), out c);
ls = GetComponentsInChildren<UILabel>(); ls = GetComponentsInChildren<UILabel>();
foreach (var item in ls) foreach (var item in ls) item.gradientBottom = c;
{
item.gradientBottom = c;
}
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
{
} }
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
using UnityEngine; using System;
using System.Collections; using UnityEngine;
using System; using Random = UnityEngine.Random;
public class priority_floating : MonoBehaviour public class priority_floating : MonoBehaviour
{ {
int open = 0; private int open;
// Use this for initialization // 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 // 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 UnityEngine;
using System.Collections;
public class spriteChanger : MonoBehaviour { public class spriteChanger : MonoBehaviour
{
public UITexture toBeChangedUITexture; public UITexture toBeChangedUITexture;
public Texture2D[] texts = new Texture2D[6]; public Texture2D[] texts = new Texture2D[6];
public void change(int i) public void change(int i)
{ {
if(i>0){ if (i > 0)
if (i < texts.Length) if (i < texts.Length)
{ toBeChangedUITexture.mainTexture = texts[i];
toBeChangedUITexture.mainTexture=texts[i];
}
}
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class mouseParticle : MonoBehaviour { public class mouseParticle : MonoBehaviour
{
public Camera camera; public Camera camera;
public ParticleSystem e1; public ParticleSystem e1;
public ParticleSystem e2; public ParticleSystem e2;
public Transform trans; public Transform trans;
private float time = 0;
// Use this for initialization // Use this for initialization
void Start () { private void Start()
{
camera.depth = 99999; camera.depth = 99999;
} }
float time = 0;
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
Vector3 screenPoint = Input.mousePosition; {
var screenPoint = Input.mousePosition;
screenPoint.z = 10; screenPoint.z = 10;
trans.position = camera.ScreenToWorldPoint(screenPoint); trans.position = camera.ScreenToWorldPoint(screenPoint);
......
using UnityEngine; using UnityEngine;
using System.Collections;
public class panelKIller : MonoBehaviour { public class panelKIller : MonoBehaviour
UIPanel pan; {
bool on = false; private bool on;
public void ini() private UIPanel pan;
{
pan = GetComponentInChildren<UIPanel>();
}
public void set(bool r)
{
on = r;
if (pan != null)
{
if (r)
{
pan.alpha = 0;
}
}
}
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
if (pan != null)
{ {
float to =0; if (pan != null)
if (on)
{ {
to = 1; float to = 0;
} if (on) to = 1;
if (Mathf.Abs(to - pan.alpha) > 0.1f) if (Mathf.Abs(to - pan.alpha) > 0.1f)
{ {
pan.alpha += (to - pan.alpha) * Program.deltaTime * 18; pan.alpha += (to - pan.alpha) * Program.deltaTime * 18;
} }
else else
{ {
if (pan.alpha != to) if (pan.alpha != to) 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 UnityEngine;
using System.Collections;
public class faceShower : MonoBehaviour { public class faceShower : MonoBehaviour
{
void Start () { 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,()=>{ gameObject.transform.position = Program.I().camera_main_2d
iTween.ScaleToAction(gameObject,Vector3.zero, 0.6f, () => { .ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
Destroy(gameObject); iTween.MoveToAction(gameObject,
}, 1f); Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2, 0)), 0.6f,
},0); () => { iTween.ScaleToAction(gameObject, Vector3.zero, 0.6f, () => { Destroy(gameObject); }, 1f); });
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public class handShower : MonoBehaviour public class handShower : MonoBehaviour
{ {
public Texture2D[] pics = new Texture2D[3]; public Texture2D[] pics = new Texture2D[3];
public int op = 0; public int op;
public int me = 0; public int me;
public UITexture texture_0; public UITexture texture_0;
public UITexture texture_1; public UITexture texture_1;
public GameObject GameObject_0; public GameObject GameObject_0;
public GameObject GameObject_1; public GameObject GameObject_1;
void Start()
private void Start()
{ {
pics[0] = GameTextureManager.get("jiandao"); pics[0] = GameTextureManager.get("jiandao");
pics[1] = GameTextureManager.get("shitou"); pics[1] = GameTextureManager.get("shitou");
pics[2] = GameTextureManager.get("bu"); pics[2] = GameTextureManager.get("bu");
texture_0.mainTexture = pics[me]; texture_0.mainTexture = pics[me];
texture_1.mainTexture = pics[op]; 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)); GameObject_0.transform.position = Program.I().camera_main_2d
iTween.MoveToAction(GameObject_0, Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f, () => { .ScreenToWorldPoint(new Vector3(Screen.width / 2, -Screen.height * 1.5f, 0));
Destroy(GameObject_0,0.3f); iTween.MoveToAction(GameObject_0,
}, 0); Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 - 80, 0)), 1f,
GameObject_1.transform.position = Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0)); () => { Destroy(GameObject_0, 0.3f); });
iTween.MoveToAction(GameObject_1, Program.I().camera_main_2d.ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height / 2 + 80, 0)), 1f, () => { GameObject_1.transform.position = Program.I().camera_main_2d
Destroy(GameObject_1, 0.3f); .ScreenToWorldPoint(new Vector3(Screen.width / 2, Screen.height * 1.5f, 0));
}, 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 UnityEngine;
using System.Collections;
public class lazyBookbtns : MonoBehaviour { public class lazyBookbtns : MonoBehaviour
{
public UILabel lable; public UILabel lable;
public UITextList textlist; public UITextList textlist;
public UISprite back; public UISprite back;
// Use this for initialization
void Start () {
// Use this for initialization
private void Start()
{
} }
// Update is called once per frame // Update is called once per frame
void Update () { private void Update()
{
} }
} }
\ No newline at end of file
using UnityEngine; using System;
using System.Collections; using UnityEngine;
using System;
public class lazyPlayer : MonoBehaviour {
public class lazyPlayer : MonoBehaviour
{
public UIToggle prep; public UIToggle prep;
public UIButton prepAsButton; public UIButton prepAsButton;
...@@ -22,20 +21,22 @@ public class lazyPlayer : MonoBehaviour { ...@@ -22,20 +21,22 @@ public class lazyPlayer : MonoBehaviour {
public Transform transformOfPrepFore; public Transform transformOfPrepFore;
int me = 0; private bool canKick;
public void ini() private int me;
{
me = int.Parse(gameObject.name); private bool mIfMe;
setIfprepared(false);
setIfMe(false); private string mName;
SetNotNull(false);
SetIFcanKick(false); private bool NotNull;
setName("");
} public Action<int> onKick = null;
public Action<int, bool> onPrepareChanged = null;
// Use this for initialization // Use this for initialization
void Start () private void Start()
{ {
UIHelper.registEvent(prepAsButton, OnPrepClicked); UIHelper.registEvent(prepAsButton, OnPrepClicked);
UIHelper.registEvent(kickAsButton, OnKickClicked); UIHelper.registEvent(kickAsButton, OnKickClicked);
...@@ -43,51 +44,46 @@ public class lazyPlayer : MonoBehaviour { ...@@ -43,51 +44,46 @@ public class lazyPlayer : MonoBehaviour {
} }
// Update is called once per frame // Update is called once per frame
void Update() private void Update()
{ {
} }
void OnPrepClicked() public void ini()
{
if (onPrepareChanged != null)
{ {
onPrepareChanged(me, prep.value); me = int.Parse(gameObject.name);
} setIfprepared(false);
setIfMe(false);
SetNotNull(false);
SetIFcanKick(false);
setName("");
} }
void OnKickClicked() private void OnPrepClicked()
{ {
Program.DEBUGLOG("OnKickClicked " + me.ToString()); if (onPrepareChanged != null) onPrepareChanged(me, prep.value);
if (onKick != null)
{
onKick(me);
} }
private void OnKickClicked()
{
Program.DEBUGLOG("OnKickClicked " + me);
if (onKick != null) onKick(me);
//setIfMe(!getIfMe());//bb //setIfMe(!getIfMe());//bb
} }
bool canKick = false;
public void SetIFcanKick(bool canKick_) public void SetIFcanKick(bool canKick_)
{ {
canKick = canKick_; canKick = canKick_;
if (canKick) if (canKick)
{
kickAsButton.gameObject.SetActive(true); kickAsButton.gameObject.SetActive(true);
}
else else
{
kickAsButton.gameObject.SetActive(false); kickAsButton.gameObject.SetActive(false);
} }
}
public bool getIfcanKick() public bool getIfcanKick()
{ {
return canKick; return canKick;
} }
bool NotNull = false;
public void SetNotNull(bool notNull_) public void SetNotNull(bool notNull_)
{ {
NotNull = notNull_; NotNull = notNull_;
...@@ -108,8 +104,6 @@ public class lazyPlayer : MonoBehaviour { ...@@ -108,8 +104,6 @@ public class lazyPlayer : MonoBehaviour {
return NotNull; return NotNull;
} }
bool mIfMe = false;
public void setIfMe(bool isMe) public void setIfMe(bool isMe)
{ {
mIfMe = isMe; mIfMe = isMe;
...@@ -132,8 +126,6 @@ public class lazyPlayer : MonoBehaviour { ...@@ -132,8 +126,6 @@ public class lazyPlayer : MonoBehaviour {
return mIfMe; return mIfMe;
} }
string mName;
public void setName(string name_) public void setName(string name_)
{ {
mName = name_; mName = name_;
...@@ -153,10 +145,6 @@ public class lazyPlayer : MonoBehaviour { ...@@ -153,10 +145,6 @@ public class lazyPlayer : MonoBehaviour {
return mName; return mName;
} }
public Action<int, bool> onPrepareChanged = null;
public Action<int> onKick = null;
public void setIfprepared(bool preped) public void setIfprepared(bool preped)
{ {
prep.value = preped; prep.value = preped;
......
using UnityEngine; using UnityEngine;
using System.Collections;
public class spining : MonoBehaviour { public class spining : MonoBehaviour
void Update () { {
transform.localEulerAngles+=(Vector3.forward * Program.deltaTime * 160); private void Update()
{
transform.localEulerAngles += Vector3.forward * Program.deltaTime * 160;
} }
} }
\ No newline at end of file
using UnityEngine; using UnityEngine;
using System.Collections;
public enum superButtonType public enum superButtonType
{ {
act, attack, bp, act,
change, ep, mp, attack,
no, see, set, bp,
spsummon, summon, yes, change,
ep,
mp,
no,
see,
set,
spsummon,
summon,
yes
} }
public class iconSetForButton : MonoBehaviour public class iconSetForButton : MonoBehaviour
{ {
public UITexture UITextureInButton; public UITexture UITextureInButton;
public UILabel UILabelInButton; public UILabel UILabelInButton;
public Texture2D act; public Texture2D act;
...@@ -26,6 +32,7 @@ public class iconSetForButton : MonoBehaviour ...@@ -26,6 +32,7 @@ public class iconSetForButton : MonoBehaviour
public Texture2D spsummon; public Texture2D spsummon;
public Texture2D summon; public Texture2D summon;
public Texture2D yes; public Texture2D yes;
public void setTexture(superButtonType type) public void setTexture(superButtonType type)
{ {
switch (type) switch (type)
...@@ -67,10 +74,12 @@ public class iconSetForButton : MonoBehaviour ...@@ -67,10 +74,12 @@ public class iconSetForButton : MonoBehaviour
UITextureInButton.mainTexture = yes; UITextureInButton.mainTexture = yes;
break; break;
} }
Color c; Color c;
ColorUtility.TryParseHtmlString(Config.Getui("gameButtonSign.color"), out c); ColorUtility.TryParseHtmlString(Config.Getui("gameButtonSign.color"), out c);
UITextureInButton.color = c; UITextureInButton.color = c;
} }
public void setText(string hint) public void setText(string hint)
{ {
UILabelInButton.text = hint; UILabelInButton.text = hint;
......
using UnityEngine; using UnityEngine;
using System.Collections;
public class hinter : MonoBehaviour { public class hinter : MonoBehaviour
{
public string str; public string str;
bool loaded = false; private bool loaded;
UIEventTrigger trigger = null;
private GameObject obj;
private UIEventTrigger trigger;
// Use this for initialization // Use this for initialization
void Start () { private void Start()
trigger = GetComponent<UIEventTrigger>();
if (trigger==null)
{ {
trigger = gameObject.AddComponent<UIEventTrigger>(); trigger = GetComponent<UIEventTrigger>();
} if (trigger == null) trigger = gameObject.AddComponent<UIEventTrigger>();
trigger.onHoverOver.Add(new EventDelegate(this, "in_")); trigger.onHoverOver.Add(new EventDelegate(this, "in_"));
trigger.onHoverOut.Add(new EventDelegate(this, "out_")); trigger.onHoverOut.Add(new EventDelegate(this, "out_"));
trigger.onPress.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.y += 45;
screenPosition.z = 0; screenPosition.z = 0;
Vector3 worldPositin = Program.I().camera_main_2d.ScreenToWorldPoint(screenPosition); 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, true); 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>().text = str;
obj.GetComponent<UILabel>().effectStyle = UILabel.Effect.Outline; obj.GetComponent<UILabel>().effectStyle = UILabel.Effect.Outline;
Program.I().destroy(obj, 5f, false, false); Program.I().destroy(obj, 5f);
} }
void out_() private void out_()
{ {
if (obj!=null) if (obj != null) Program.I().destroy(obj, 0.6f, true, true);
{
Program.I().destroy(obj, 0.6f, true, true);
}
}
// Update is called once per frame
void Update()
{
if (loaded == false)
{
if (InterString.loaded == true)
{
loaded = true;
str = InterString.Get(str);
}
}
} }
} }
\ No newline at end of file
using UnityEngine; using System;
using System.Collections; using UnityEngine;
public class setbar : MonoBehaviour { public class setbar : MonoBehaviour
public void show(){ {
public void show()
{
try try
{ {
if (Program.I().setting.isShowed) if (Program.I().setting.isShowed)
{
Program.I().setting.hide(); Program.I().setting.hide();
}
else else
{
Program.I().setting.show(); Program.I().setting.show();
} }
} catch (Exception)
catch (System.Exception)
{ {
} }
} }
public void book() public void book()
{ {
try try
{ {
if (Program.I().book.isShowed) if (Program.I().book.isShowed)
{
Program.I().book.hide(); Program.I().book.hide();
}
else else
{
Program.I().book.show(); Program.I().book.show();
} }
} catch (Exception)
catch (System.Exception)
{ {
} }
} }
......
using UnityEngine; using UnityEngine;
using System.Collections;
public class toolShift : MonoBehaviour { public class toolShift : MonoBehaviour
public GameObject ObjectMust = null; {
public GameObject ObjectOption = null; public GameObject ObjectMust;
public GameObject ObjectOption;
void Update() private void Update()
{ {
if (Program.InputEnterDown) if (Program.InputEnterDown)
{
if (ObjectMust.name == "input_") if (ObjectMust.name == "input_")
{ {
UIInput input = UIHelper.getByName<UIInput>(ObjectMust, "input_"); var input = UIHelper.getByName<UIInput>(ObjectMust, "input_");
if (input != null) if (input != null)
{ {
if (ObjectMust.transform.localPosition.y < 0) if (ObjectMust.transform.localPosition.y < 0)
...@@ -37,25 +36,20 @@ public class toolShift : MonoBehaviour { ...@@ -37,25 +36,20 @@ public class toolShift : MonoBehaviour {
} }
} }
} }
}
public void shift() public void shift()
{ {
Vector3 va = ObjectMust.transform.localPosition; var va = ObjectMust.transform.localPosition;
if (ObjectOption == null) if (ObjectOption == null)
{ {
if (va.y >= 0) if (va.y >= 0)
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f); iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f);
}
else else
{
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, 0, va.z), 0.6f); iTween.MoveToLocal(ObjectMust, new Vector3(va.x, 0, va.z), 0.6f);
} }
}
else else
{ {
Vector3 vb = ObjectOption.transform.localPosition; var vb = ObjectOption.transform.localPosition;
if (va.y > vb.y) if (va.y > vb.y)
{ {
iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f); iTween.MoveToLocal(ObjectMust, new Vector3(va.x, -100, va.z), 0.6f);
......
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