Skip to content

Commit

Permalink
Mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
kyechan99 committed Aug 1, 2017
1 parent dc92d60 commit c9e23b2
Show file tree
Hide file tree
Showing 2,614 changed files with 1,604 additions and 307 deletions.
1,495 changes: 1,360 additions & 135 deletions Assets/Scenes/InGame.unity

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions Assets/Scenes/Loading.unity
Original file line number Diff line number Diff line change
Expand Up @@ -847,10 +847,10 @@ MonoBehaviour:
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ReferenceResolution: {x: 1280, y: 720}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
Expand Down
4 changes: 2 additions & 2 deletions Assets/Scenes/Login.unity
Original file line number Diff line number Diff line change
Expand Up @@ -1866,7 +1866,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.66317195, g: 0.37959558, b: 0.875, a: 1}
m_Color: {r: 0.32738334, g: 0.9275862, b: 0.79518855, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
Expand Down Expand Up @@ -2530,7 +2530,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.66317195, g: 0.37959558, b: 0.875, a: 1}
m_Color: {r: 0.32738334, g: 0.9275862, b: 0.79518855, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
Expand Down
9 changes: 5 additions & 4 deletions Assets/Scripts/GM/LoadingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private void Awake()
{
StartCoroutine(LoadScene());

switch (Random.Range(0, 6))
switch (Random.Range(0, 7))
{
case 0:
descTxt.text = "알고 계시나요? 도둑과 경찰의 색이 같으면 도둑은 닿기만 해도 죽습니다 !";
Expand All @@ -35,8 +35,11 @@ private void Awake()
case 4:
descTxt.text = "경찰 MVP 조건 : 많이 죽이고 공격을 최소한으로 사용했을 때 MVP 획득확률이 올라갑니다 !";
break;
case 5:
descTxt.text = "알고 계시나요? Shape-Of-You 서버/클라의 제작기간은 고삐리 둘이서 4일 걸렸어요 !!";
break;
default:
descTxt.text = "알고 계시나요 ? Shape-Of-You 서버/클라의 제작기간은 고삐리 둘이서 4일 걸렸어요 !!";
descTxt.text = "알고 계시나요? Shape-Of-You는 모바일/윈도우 환경을 모두 지원합니다 !!";
break;
}
}
Expand All @@ -50,8 +53,6 @@ public static void LoadScene(string sceneName)

IEnumerator LoadScene()
{
bool once = false;

yield return null;

AsyncOperation op = SceneManager.LoadSceneAsync(nextScene);
Expand Down
26 changes: 24 additions & 2 deletions Assets/Scripts/GM/NetworkManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public class NetworkManager : MonoBehaviour
{
static Socket socket = null;
public string address = "127.0.0.1"; // 주소, 서버 주소와 같게 할 것
string version = "1.2.1";
string version = "1.2.2";
int port = 10000; // 포트 번호, 서버포트와 같게 할 것
byte[] buf = new byte[4096];
int recvLen = 0;
Expand Down Expand Up @@ -51,7 +51,12 @@ public static NetworkManager getInstance

void Awake()
{
#if UNITY_ANDROID
Debug.Log("Unity Editor");
#else
Screen.SetResolution(1280, 720, false);
#endif

DontDestroyOnLoad(this);
_instance = this;
versionTxt.text = "ver " + version;
Expand Down Expand Up @@ -509,7 +514,7 @@ IEnumerator waitForNameShow()
/**
* @brief 기기에서 접속을 끊었을때
*/
void OnDestroy()
void Exit()
{
if (socket != null && socket.Connected)
{
Expand All @@ -519,6 +524,23 @@ void OnDestroy()
}
StopCoroutine("PacketProc");
}
void OnDestroy()
{
Exit();
}

void OnApplicationQuit()
{
#if UNITY_ANDROID
Exit();
#endif
}
void OnApplicationPause(bool pauseStatus)
{
#if UNITY_ANDROID
Exit();
#endif
}

/**
* @brief 게임내 로그아웃, 접속 종료
Expand Down
62 changes: 62 additions & 0 deletions Assets/Scripts/SUi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,19 @@ public class SUi : MonoBehaviour
GameObject LifeGame = null;
public UnityEngine.UI.Text countLife;

[SerializeField]
GameObject mobileUi;

public static MOVE_CONTROL mobileMove = MOVE_CONTROL.STOP;
public static bool mobileSpace = false;

void Start()
{
SGameMng.I.bStartCheck = false;

#if UNITY_ANDROID
mobileUi.SetActive(true);
#endif
}

void Update()
Expand Down Expand Up @@ -91,4 +101,56 @@ public void start()
public void LifeActive() { LifeGame.SetActive(true); }
public void LifeReset() { LifeGame.SetActive(false); }


public void keyUpDown()
{
mobileMove = MOVE_CONTROL.UP;
}
public void keyUpUp()
{
if (mobileMove.Equals(MOVE_CONTROL.UP))
mobileMove = MOVE_CONTROL.STOP;
}
public void keyLeftDown()
{
mobileMove = MOVE_CONTROL.LEFT;
}
public void keyLeftUp()
{
if (mobileMove.Equals(MOVE_CONTROL.LEFT))
mobileMove = MOVE_CONTROL.STOP;
}
public void keyRightDown()
{
mobileMove = MOVE_CONTROL.RIGHT;
}
public void keyRightUp()
{
if (mobileMove.Equals(MOVE_CONTROL.RIGHT))
mobileMove = MOVE_CONTROL.STOP;
}
public void keyDownDown()
{
mobileMove = MOVE_CONTROL.DOWN;
}
public void keyDownUp()
{
if (mobileMove.Equals(MOVE_CONTROL.DOWN))
mobileMove = MOVE_CONTROL.STOP;
}

public void keySpaceDown()
{
mobileSpace = true;
}


public void aaaaa()
{
Debug.Log("DD");
}
public void aaaaaaaaa()
{
Debug.Log("DDDDD");
}
}
16 changes: 10 additions & 6 deletions Assets/Scripts/User/SPlayerMove.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,11 @@ void Update()
else if (proper.Equals(PROPER.THIEF))
{
SGameMng.I.uiScrp.countLife.text = (nhp - 1).ToString();
if (Input.GetKeyDown(KeyCode.Space) && !SGameMng.I.isWritting)
if ((Input.GetKeyDown(KeyCode.Space) || SUi.mobileSpace ) && !SGameMng.I.isWritting)
{
SUi.mobileSpace = false;
GM.NetworkManager.getInstance.SendMsg(string.Format("KINEMATIC:{0}", myIdx));
}
}
Blind();
if (!bStartup) KeyDown();
Expand All @@ -64,8 +67,9 @@ void Update()
GM.NetworkManager.getInstance.SendMsg(string.Format("MOVE:{0}:{1}:{2}:{3}", myIdx, transform.position.x, transform.position.y, (int)myMove));
beforeMove = myMove;
}
if (Input.GetKeyDown(KeyCode.Space) && proper.Equals(PROPER.POLICE) && !isSkill && !bStartup && !SGameMng.I.isWritting)
if ((Input.GetKeyDown(KeyCode.Space) || SUi.mobileSpace) && proper.Equals(PROPER.POLICE) && !isSkill && !bStartup && !SGameMng.I.isWritting)
{
SUi.mobileSpace = false;
if (nhp < 1)
{
GM.NetworkManager.getInstance.SendMsg(string.Format("DIE:{0}:{1}", myIdx, myIdx));
Expand Down Expand Up @@ -157,10 +161,10 @@ void Blind()

void KeyDown()
{
if (Input.GetKey(KeyCode.UpArrow) && !SGameMng.I.isWritting) myMove = MOVE_CONTROL.UP;
else if (Input.GetKey(KeyCode.LeftArrow) && !SGameMng.I.isWritting) myMove = MOVE_CONTROL.LEFT;
else if (Input.GetKey(KeyCode.RightArrow) && !SGameMng.I.isWritting) myMove = MOVE_CONTROL.RIGHT;
else if (Input.GetKey(KeyCode.DownArrow) && !SGameMng.I.isWritting) myMove = MOVE_CONTROL.DOWN;
if ((Input.GetKey(KeyCode.UpArrow) || SUi.mobileMove.Equals(MOVE_CONTROL.UP)) && !SGameMng.I.isWritting) myMove = MOVE_CONTROL.UP;
else if ((Input.GetKey(KeyCode.LeftArrow) || SUi.mobileMove.Equals(MOVE_CONTROL.LEFT)) && !SGameMng.I.isWritting) myMove = MOVE_CONTROL.LEFT;
else if ((Input.GetKey(KeyCode.RightArrow) || SUi.mobileMove.Equals(MOVE_CONTROL.RIGHT)) && !SGameMng.I.isWritting) myMove = MOVE_CONTROL.RIGHT;
else if ((Input.GetKey(KeyCode.DownArrow) || SUi.mobileMove.Equals(MOVE_CONTROL.DOWN)) && !SGameMng.I.isWritting) myMove = MOVE_CONTROL.DOWN;
else myMove = MOVE_CONTROL.STOP;
}

Expand Down
8 changes: 4 additions & 4 deletions Assets/Scripts/User/SWatching.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,19 @@ public void CameraMove()
{
if (!bDie)
{
if (Input.GetKey(KeyCode.UpArrow) && transform.localPosition.y < 33f)
if ((Input.GetKey(KeyCode.UpArrow) || SUi.mobileMove.Equals(MOVE_CONTROL.UP)) && transform.localPosition.y < 33f)
{
transform.Translate(Vector3.up * 12f * Time.deltaTime);
}
if (Input.GetKey(KeyCode.DownArrow) && transform.localPosition.y > -33f)
if ((Input.GetKey(KeyCode.DownArrow) || SUi.mobileMove.Equals(MOVE_CONTROL.DOWN)) && transform.localPosition.y > -33f)
{
transform.Translate(Vector3.down * 12f * Time.deltaTime);
}
if (Input.GetKey(KeyCode.LeftArrow) && transform.localPosition.x > -55f)
if ((Input.GetKey(KeyCode.LeftArrow) || SUi.mobileMove.Equals(MOVE_CONTROL.LEFT)) && transform.localPosition.x > -55f)
{
transform.Translate(Vector3.left * 12f * Time.deltaTime);
}
if (Input.GetKey(KeyCode.RightArrow) && transform.localPosition.x < 55f)
if ((Input.GetKey(KeyCode.RightArrow) || SUi.mobileMove.Equals(MOVE_CONTROL.RIGHT)) && transform.localPosition.x < 55f)
{
transform.Translate(Vector3.right * 12f * Time.deltaTime);
}
Expand Down
2 changes: 1 addition & 1 deletion Library/AssetImportState
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5;0;6;0;0
13;537460736;2099456;0;0
Loading

0 comments on commit c9e23b2

Please sign in to comment.