Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
77 commits
Select commit Hold shift + click to select a range
1a4e8d9
update
xavgru12 Sep 7, 2025
5d07429
install input system
xavgru12 Sep 7, 2025
0a2f640
change to new input system
xavgru12 Sep 7, 2025
e8a057f
add a button, log appears when its clicked
xavgru12 Sep 7, 2025
f5af2c4
add new input system to player prefab and use it for jump
xavgru12 Sep 11, 2025
fde9aa1
add jump button that triggers jump correctly
xavgru12 Sep 13, 2025
62e407e
re arrange
xavgru12 Sep 13, 2025
a48fedd
make it blue and transparent
xavgru12 Sep 13, 2025
442f31c
add white wheel stick that moves
xavgru12 Sep 13, 2025
b3cc644
use inputsystem to move including joystick
xavgru12 Sep 13, 2025
c4a236a
move joystick
xavgru12 Sep 14, 2025
bbc8035
add shoot button, mapped to keyboard to for debugging
xavgru12 Sep 14, 2025
7c72b17
map shoot button correctly
xavgru12 Sep 14, 2025
d1e0faf
move buttons so it is better for small phones
xavgru12 Sep 14, 2025
ce0bec3
add aim action for snipers etc
xavgru12 Sep 14, 2025
a3ca890
add pause game button
xavgru12 Sep 14, 2025
9b3ec20
add button to switch to next weapon
xavgru12 Sep 14, 2025
f7e8405
remove comments
xavgru12 Sep 14, 2025
9b80bd7
rename to scrollwheel
xavgru12 Sep 14, 2025
3e1df50
add jump button in player prefab
xavgru12 Sep 14, 2025
2aa42ed
make buttons smaller and blue transparent
xavgru12 Sep 14, 2025
e5d2d63
improve android build settings
xavgru12 Sep 14, 2025
34cf312
adjust
xavgru12 Sep 14, 2025
70c67c0
use both input systems
xavgru12 Sep 14, 2025
7091e97
add mouse scroll action
xavgru12 Sep 14, 2025
d0dfac9
refactor previous and next
xavgru12 Sep 14, 2025
cf7e651
rename attack to shoot
xavgru12 Sep 14, 2025
6f28cf5
revert file project settings
xavgru12 Sep 14, 2025
ada9b0f
forced to set this
xavgru12 Sep 14, 2025
4c9eeff
unity wanted to set it to 2, tested in game: both input systems work
xavgru12 Sep 21, 2025
f277847
only display mobile controls when a touchscreen is avaiable
xavgru12 Sep 21, 2025
4ce3277
remove duplicate event system and use new input system in event system
xavgru12 Sep 21, 2025
92a47a9
add joystick pack
xavgru12 Sep 21, 2025
ff2c555
style joystick
xavgru12 Sep 21, 2025
85a67b8
add texts to button
xavgru12 Sep 21, 2025
e91d694
move button
xavgru12 Sep 21, 2025
d988644
use input system to toggle stats
xavgru12 Sep 21, 2025
8371e88
add textmeshpro to packages
Sep 24, 2025
682bd23
add mac toolchain to packages
xavgru12 Sep 24, 2025
66364de
change identifier for ios
xavgru12 Sep 24, 2025
9523fac
delete unneeded input actions
xavgru12 Sep 24, 2025
458e2dd
do not move look camera when on joystick
xavgru12 Sep 24, 2025
3ba509c
add input system settings
xavgru12 Sep 27, 2025
1cf4ff3
use input system for look around
xavgru12 Sep 27, 2025
8b2cd8a
add finger gestures
xavgru12 Sep 27, 2025
b964396
player input script, look around functionality with fingergestures
xavgru12 Sep 27, 2025
6fdfdde
some settings file
xavgru12 Sep 27, 2025
4c000f9
update fingergestures
xavgru12 Sep 27, 2025
6c1882e
remove comments
xavgru12 Sep 27, 2025
9162f84
remove obsolete code
xavgru12 Sep 27, 2025
f27b74c
add back look around for desktop
xavgru12 Sep 28, 2025
9820d4d
add useful comment
xavgru12 Sep 28, 2025
047313d
fix typo
xavgru12 Sep 28, 2025
158aa6b
remove comment
xavgru12 Sep 28, 2025
b370cab
move inout system for chat
xavgru12 Sep 28, 2025
80921c4
move chat toggle to playermanager
xavgru12 Sep 28, 2025
4d4dc97
remove comment
xavgru12 Sep 28, 2025
f8f5109
use new input system for chat
xavgru12 Sep 28, 2025
bbc1935
add log for connecting host
xavgru12 Sep 28, 2025
845f44a
add chat button to player prefab
xavgru12 Sep 28, 2025
0370dc3
mobile keyboard: able to click ready or close
xavgru12 Sep 28, 2025
9338199
fix last sent message not appearing on mobile
xavgru12 Sep 28, 2025
d5fd665
merge
xavgru12 Oct 1, 2025
c519ef1
right mouse click to scope
xavgru12 Oct 1, 2025
9ec28bc
use host from code, not prefab
xavgru12 Oct 1, 2025
ff903d6
Merge remote-tracking branch 'refs/remotes/origin/new-input-system-ju…
xavgru12 Oct 1, 2025
6f3f442
add back chat and cancelchat
xavgru12 Oct 1, 2025
07b61c9
update readme
xavgru12 Oct 1, 2025
88a818f
remove unneeded components@
xavgru12 Oct 2, 2025
df07596
mobile controls
xavgru12 Oct 2, 2025
17e7c1d
add new chat button
xavgru12 Oct 4, 2025
28c50ac
move chat button
xavgru12 Oct 4, 2025
8d6906b
add pause game button
xavgru12 Oct 4, 2025
3c9e7a4
add statistics button
xavgru12 Oct 4, 2025
7b68de6
add crouch button
xavgru12 Oct 4, 2025
b825802
add more buttons
xavgru12 Oct 4, 2025
f9149ae
add switch button: hard code to sniper
xavgru12 Oct 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "Assets/LibraryAssets/FingerGestures"]
path = Assets/LibraryAssets/FingerGestures
url = git@github.com:DigitalRuby/FingersGestures.git
8 changes: 8 additions & 0 deletions Assets/Gameplay/Debug.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions Assets/Gameplay/Debug/DestroyOldEventSystems.cs

This file was deleted.

43 changes: 2 additions & 41 deletions Assets/Gameplay/Network Scripts/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
public class Client : TcpEngine
{
// Connection
public string host = "127.0.0.1";
internal string host = "127.0.0.1";
public int port = 8001;

private Transform player;
Expand Down Expand Up @@ -82,39 +82,7 @@ private void CheckTheLead()

}

// Hide / Show stats
void ToggleStats(bool show)
{
statsCanvas.transform.GetChild(0).gameObject.SetActive(show);
}

// Hide / show chat
void ToggleChat()
{
if (!log.chatActive)
{
log.ToggleChat(true);

if (GameObject.Find("/Player"))
{
GameObject p = GameObject.Find("/Player");
p.GetComponent<PlayerInput>().enabled = false; // Stop inputs
p.GetComponent<PlayerMotor>().Move(0f, 0f); // Stop player
p.GetComponent<PlayerMotor>().MouseLook(0f, 0f);
}
}
else
{
log.ToggleChat(false);
if (GameObject.Find("/Player")) {
if(!GameObject.Find("/Player").GetComponent<PlayerManager>().gamePaused)
GameObject.Find("/Player").GetComponent<PlayerInput>().enabled = true;
//Cursor.visible = false;
//Cursor.lockState = CursorLockMode.Locked;
}

}
}

// Handle player transform when dead/alive
public void AssignLocalPlayer(Transform newLocalPlayer)
Expand Down Expand Up @@ -241,6 +209,7 @@ void SendAppereances()

public override void ConnectionResolve(bool success)
{
print("Connecting to " + host + ":" + port + " ...");
if (success == false)
{
Debug.LogWarning("Connection failed: " + host);
Expand Down Expand Up @@ -287,14 +256,6 @@ void Update()
{
RunOnMainThread.Dequeue().Invoke();
}

// Get TAB key
// This Input is hardcoded. We should make input axis for this later
ToggleStats(Input.GetKey(KeyCode.Tab));

// Toggle chat
if (Input.GetKeyDown("return")) { if (log.chatActive) log.ChatEditEnd(); ToggleChat(); }
if (Input.GetKeyDown(KeyCode.Escape)) { if (log.chatActive) ToggleChat();}
}

public override void Packet(byte[] data)
Expand Down
115 changes: 108 additions & 7 deletions Assets/Gameplay/Network Scripts/LobbyLog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,108 @@ public void LogMessage(string entrySubject, string entryEvent, string entryObjec
//else if (friendlyObject == null) obj.GetComponent<Outline>().effectColor = outlineBlack;
}

private void Start()
{
// Hook into InputField events for proper mobile keyboard handling
if (field != null)
{
field.onEndEdit.AddListener(OnChatInputEndEdit);
}
}

private void OnChatInputEndEdit(string text)
{
// Only handle this for mobile platforms - desktop uses PlayerInput Return key handling
if (Application.isMobilePlatform && chatActive)
{
// Find PlayerManager to handle the chat toggle
GameObject player = GameObject.Find("/Player");
if (player != null)
{
PlayerManager playerManager = player.GetComponent<PlayerManager>();
if (playerManager != null)
{
// Check if text was entered (Ready button) or empty (Cancel button)
if (!string.IsNullOrEmpty(text.Trim()))
{
// Ready button pressed with text - close chat first, then send message
// This ensures the message is processed when chatActive is false
playerManager.ToggleChat(); // Close chat first
ChatEditEnd(); // Then send message
}
else
{
// Cancel button or empty text - just close chat
field.text = "";
playerManager.ToggleChat();
}
}
}
}
// Desktop behavior is handled by PlayerInput Return key detection
}

internal void ToggleChat(bool visible)
{
chatPanel.SetActive(true);
chatActive = visible;

field.gameObject.SetActive(visible);
field.ActivateInputField();
field.Select();
scroll.value = 0f;
if (visible)
{
field.ActivateInputField();
field.Select();
}
scroll.value = 1f;
}

public void AddChatMessage(string message, bool isSelf)
{
Debug.Log($"AddChatMessage called: message='{message}', isSelf={isSelf}, chatActive={chatActive}");

chatPanel.SetActive(true);
field.gameObject.SetActive(chatActive);

Text chatItemClone = Instantiate(chatItemPrefab);
chatItemClone.text = message;
chatItemClone.transform.SetParent(chatContent, false);

// Disable any layout groups that might interfere
var layoutGroup = chatContent.GetComponent<UnityEngine.UI.VerticalLayoutGroup>();
if (layoutGroup != null) layoutGroup.enabled = false;

var contentSizeFitter = chatContent.GetComponent<UnityEngine.UI.ContentSizeFitter>();
if (contentSizeFitter != null) contentSizeFitter.enabled = false;

// Fix positioning - ensure message is positioned correctly within content bounds
RectTransform msgRect = chatItemClone.GetComponent<RectTransform>();
msgRect.anchorMin = new Vector2(0, 1);
msgRect.anchorMax = new Vector2(1, 1);
msgRect.pivot = new Vector2(0.5f, 1);

// Position messages stacked from top, within visible bounds
int messageIndex = chatContent.childCount - 1;
float yPosition = -25f * messageIndex; // 25 pixels per message
msgRect.anchoredPosition = new Vector2(0, yPosition);
msgRect.sizeDelta = new Vector2(-10, 20); // Full width minus padding, 20px height

Debug.Log($"Applied positioning: messageIndex={messageIndex}, yPosition={yPosition}");

// Force layout refresh
UnityEngine.UI.LayoutRebuilder.ForceRebuildLayoutImmediate(chatContent.GetComponent<RectTransform>());

Debug.Log($"Message instantiated and added. ChatPanel active: {chatPanel.activeInHierarchy}");
Debug.Log($"ChatContent active: {chatContent.gameObject.activeInHierarchy}, ChatContent child count: {chatContent.childCount}");
Debug.Log($"Message clone active: {chatItemClone.gameObject.activeInHierarchy}, Message text: '{chatItemClone.text}'");

// Check UI positioning and sizes
RectTransform chatPanelRect = chatPanel.GetComponent<RectTransform>();
RectTransform chatContentRect = chatContent.GetComponent<RectTransform>();
RectTransform messageRect = chatItemClone.GetComponent<RectTransform>();

Debug.Log($"ChatPanel size: {chatPanelRect.rect.size}, position: {chatPanelRect.anchoredPosition}");
Debug.Log($"ChatContent size: {chatContentRect.rect.size}, position: {chatContentRect.anchoredPosition}");
Debug.Log($"Message size: {messageRect.rect.size}, position: {messageRect.anchoredPosition}");

StartCoroutine(Scroll());

Expand All @@ -73,22 +156,40 @@ public void AddChatMessage(string message, bool isSelf)

IEnumerator Scroll()
{
yield return new WaitForSeconds(0.02f);
scroll.value = 0f;
yield return new WaitForEndOfFrame();
yield return new WaitForEndOfFrame();
Debug.Log($"Setting scroll.value to 1f. Current value was: {scroll.value}");
scroll.value = 1f;

// Check scroll rect setup
ScrollRect scrollRect = scroll.GetComponentInParent<ScrollRect>();
if (scrollRect != null)
{
Debug.Log($"ScrollRect found. Content: {scrollRect.content?.name}, Viewport: {scrollRect.viewport?.name}");
Debug.Log($"ScrollRect normalizedPosition: {scrollRect.normalizedPosition}");
}
else
{
Debug.Log("No ScrollRect component found!");
}
}

IEnumerator HideChat()
{
Debug.Log("HideChat coroutine started, waiting 4 seconds...");
yield return new WaitForSeconds(4f);
Debug.Log($"HideChat timer expired. chatActive={chatActive}, will hide chat: {!chatActive}");
if (!chatActive) chatPanel.SetActive(false);
scroll.value = 0f;
scroll.value = 1f;
}



public void ChatEditEnd()
{
if(field.text.Length>0&& field.text.Length < 101) GameObject.Find("/Network Client").SendMessage("SendChatMessage", field.text);
field.text = "";
scroll.value = 0f;
scroll.value = 1f;
}

}
8 changes: 8 additions & 0 deletions Assets/Gameplay/Player Scrips/MobileControls.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

87 changes: 87 additions & 0 deletions Assets/Gameplay/Player Scrips/MobileControls/MobileIcons.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
using UnityEngine;

public static class MobileIcons
{
public static Material TextureAtlas { get; private set; }

public static Rect TouchArrowLeft { get; private set; }

public static Rect TouchArrowRight { get; private set; }

public static Rect TouchChatButton { get; private set; }

public static Rect TouchCrouchButton { get; private set; }

public static Rect TouchCrouchButtonActive { get; private set; }

public static Rect TouchFireButton { get; private set; }

public static Rect TouchJumpButton { get; private set; }

public static Rect TouchKeyboardDpad { get; private set; }

public static Rect TouchMenuButton { get; private set; }

public static Rect TouchMoveInner { get; private set; }

public static Rect TouchMoveOuter { get; private set; }

public static Rect TouchScoreboardButton { get; private set; }

public static Rect TouchSecondFireButton { get; private set; }

public static Rect TouchWeaponCannon { get; private set; }

public static Rect TouchWeaponHandgun { get; private set; }

public static Rect TouchWeaponLauncher { get; private set; }

public static Rect TouchWeaponMachinegun { get; private set; }

public static Rect TouchWeaponMelee { get; private set; }

public static Rect TouchWeaponShotgun { get; private set; }

public static Rect TouchWeaponSniperrifle { get; private set; }

public static Rect TouchWeaponSplattergun { get; private set; }

public static Rect TouchZoomScrollbar { get; private set; }

static MobileIcons()
{
Texture2DAtlasHolder component;
try
{
component = GameObject.Find("MobileIcons").GetComponent<Texture2DAtlasHolder>();
}
catch
{
Debug.LogError("Missing instance of the prefab with name: MobileIcons!");
return;
}
TextureAtlas = component.Atlas;
TouchArrowLeft = new Rect(0.1582031f, 113f / 128f, 0.01074219f, 1f / 64f);
TouchArrowRight = new Rect(0.1582031f, 0.89941406f, 0.01074219f, 1f / 64f);
TouchChatButton = new Rect(0.1132813f, 113f / 128f, 0.04394531f, 0.043945316f);
TouchCrouchButton = new Rect(0.6962891f, 0.5f, 0.07421875f, 0.0732422f);
TouchCrouchButtonActive = new Rect(0.7714844f, 0.5f, 0.07421875f, 0.0732422f);
TouchFireButton = new Rect(0f, 113f / 128f, 0.1123047f, 0.11132815f);
TouchJumpButton = new Rect(0.5439453f, 0.5f, 0.07617188f, 0.07421875f);
TouchKeyboardDpad = new Rect(0f, 0.5f, 25f / 64f, 0.20410155f);
TouchMenuButton = new Rect(0.1132813f, 0.9277344f, 0.04394531f, 0.043945316f);
TouchMoveInner = new Rect(0.3916016f, 0.8808594f, 0.09082031f, 0.0908203f);
TouchMoveOuter = new Rect(0f, 0.7050781f, 0.1767578f, 0.1767578f);
TouchScoreboardButton = new Rect(0.3300781f, 0.7050781f, 0.04394531f, 0.043945316f);
TouchSecondFireButton = new Rect(0.6210938f, 0.5f, 0.07421875f, 0.07421875f);
TouchWeaponCannon = new Rect(0.1777344f, 0.7050781f, 0.1513672f, 0.0751953f);
TouchWeaponHandgun = new Rect(0.1777344f, 25f / 32f, 0.1513672f, 0.0751953f);
TouchWeaponLauncher = new Rect(0.1777344f, 0.8574219f, 0.1513672f, 0.0751953f);
TouchWeaponMachinegun = new Rect(0.3916016f, 0.5f, 0.1513672f, 0.0751953f);
TouchWeaponMelee = new Rect(0.3916016f, 0.5761719f, 0.1513672f, 0.0751953f);
TouchWeaponShotgun = new Rect(0.3916016f, 0.65234375f, 0.1513672f, 0.0751953f);
TouchWeaponSniperrifle = new Rect(0.3916016f, 0.7285156f, 0.1513672f, 0.0751953f);
TouchWeaponSplattergun = new Rect(0.3916016f, 103f / 128f, 0.1513672f, 0.0751953f);
TouchZoomScrollbar = new Rect(0.5439453f, 0.5751953f, 0.02636719f, 0.18652345f);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions Assets/Gameplay/Player Scrips/MobileControls/MobileIcons.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: MobileIcons
m_Shader: {fileID: 4800000, guid: 4d5ad2e6a122b514e994d0eee0827da6, type: 3}
m_ShaderKeywords: []
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
- first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 1f576212b1224124284368c6bf480f02, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
- first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading