Commit cfb06f53 authored by Ben Huber's avatar Ben Huber
Browse files

steam achievements should work now

parent 1f950e3f
......@@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.3587274, a: 1}
m_IndirectSpecularColor: {r: 0.37311953, g: 0.38074014, b: 0.35872743, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
......@@ -2148,7 +2148,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
m_IsActive: 1
--- !u!114 &1090495307
MonoBehaviour:
m_ObjectHideFlags: 0
......@@ -2156,7 +2156,7 @@ MonoBehaviour:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1090495306}
m_Enabled: 1
m_Enabled: 0
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c746b3472c20214f489ab756d9a0b225, type: 3}
m_Name:
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Steamworks;
public class Activatable_DisappearingFloor : Activatable
{
......@@ -18,5 +19,9 @@ public class Activatable_DisappearingFloor : Activatable
private void DropFloor()
{
floor.SetActive(false);
if (SteamManager.Initialized) {
SteamUserStats.SetAchievement("START");
Debug.Log("StoreStats(): " + SteamUserStats.StoreStats());
}
}
}
......@@ -2,12 +2,14 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using Steamworks;
public class Activatable_endScene : Activatable
{
bool once;
bool once = false;
Vector3 originalCamPosition;
Quaternion originalCamRotation;
public override void Hover()
{
if (!once)
......@@ -20,12 +22,17 @@ public class Activatable_endScene : Activatable
Invoke("StartFade", 10f);
Invoke("StartFadeText", 17f);
Invoke("ShowUI", 19f);
if (SteamManager.Initialized) {
SteamUserStats.SetAchievement("FINISH_GAME");
Debug.Log("StoreStats(): " + SteamUserStats.StoreStats());
}
}
}
public Transform targetAnchor;
public float duration = 20;
float progress = 0;
private void Update()
{
if (once)
......@@ -40,35 +47,35 @@ public class Activatable_endScene : Activatable
{
Fade.instance.act = true;
}
void StartFadeText()
{
void StartFadeText() {
//FadeText.instance.act = true;
}
void ShowUI()
{
void ShowUI() {
//FadeText.instance.button.gameObject.SetActive(true);
//InputMode.SetModeUI();
Activatable_Hoverglow.roomflags = new Dictionary<Activatable_Hoverglow.RoomFlag, bool> {
{Activatable_Hoverglow.RoomFlag.cis, false },
{Activatable_Hoverglow.RoomFlag.demi, false },
{Activatable_Hoverglow.RoomFlag.drag, false },
{Activatable_Hoverglow.RoomFlag.euphoria, false },
{Activatable_Hoverglow.RoomFlag.exit, false },
{Activatable_Hoverglow.RoomFlag.fem, false },
{Activatable_Hoverglow.RoomFlag.fluid, false },
{Activatable_Hoverglow.RoomFlag.hijra, false },
{Activatable_Hoverglow.RoomFlag.inter, false },
{Activatable_Hoverglow.RoomFlag.map, false },
{Activatable_Hoverglow.RoomFlag.nonBinary, false },
{Activatable_Hoverglow.RoomFlag.passing, false },
{Activatable_Hoverglow.RoomFlag.pronoun, false },
{Activatable_Hoverglow.RoomFlag.queer, false },
{Activatable_Hoverglow.RoomFlag.trans, false },
{Activatable_Hoverglow.RoomFlag.twospirited, false },
{Activatable_Hoverglow.RoomFlag.voidR, false },
{Activatable_Hoverglow.RoomFlag.outside, false },
{Activatable_Hoverglow.RoomFlag.staircase, false }
};
{Activatable_Hoverglow.RoomFlag.cis, false },
{Activatable_Hoverglow.RoomFlag.demi, false },
{Activatable_Hoverglow.RoomFlag.drag, false },
{Activatable_Hoverglow.RoomFlag.euphoria, false },
{Activatable_Hoverglow.RoomFlag.exit, false },
{Activatable_Hoverglow.RoomFlag.fem, false },
{Activatable_Hoverglow.RoomFlag.fluid, false },
{Activatable_Hoverglow.RoomFlag.hijra, false },
{Activatable_Hoverglow.RoomFlag.inter, false },
{Activatable_Hoverglow.RoomFlag.map, false },
{Activatable_Hoverglow.RoomFlag.nonBinary, false },
{Activatable_Hoverglow.RoomFlag.passing, false },
{Activatable_Hoverglow.RoomFlag.pronoun, false },
{Activatable_Hoverglow.RoomFlag.queer, false },
{Activatable_Hoverglow.RoomFlag.trans, false },
{Activatable_Hoverglow.RoomFlag.twospirited, false },
{Activatable_Hoverglow.RoomFlag.voidR, false },
{Activatable_Hoverglow.RoomFlag.outside, false },
{Activatable_Hoverglow.RoomFlag.staircase, false }
};
SceneManager.LoadScene(1);
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using Steamworks;
public class AudioTrigger : MonoBehaviour {
public AudioClip voiceLine;
......@@ -9,11 +11,12 @@ public class AudioTrigger : MonoBehaviour {
[TextArea(4, 4)] public string text_EN;
public Color textColor = Color.white;
public bool repeatable = false;
public bool pronoun = false;
static Dictionary<string,bool> triggered = new Dictionary<string, bool>();
private void Awake() {
if (!triggered.ContainsKey(text)) {
if (!repeatable && !triggered.ContainsKey(text)) {
triggered[text] = false;
}
gameObject.layer = 2;
......@@ -21,7 +24,25 @@ public class AudioTrigger : MonoBehaviour {
private void OnTriggerEnter(Collider other) {
if (!triggered[text] || repeatable) {
if(Narration.instance.Play(Menu.LangIsEnglish()?voiceLine_EN:voiceLine, Menu.LangIsEnglish() ? text_EN : text, textColor)) triggered[text] = true;
if(Narration.instance.Play(Menu.LangIsEnglish()?voiceLine_EN:voiceLine, Menu.LangIsEnglish() ? text_EN : text, textColor)) {
if (repeatable) {
triggered[text] = true;
// check if this was the last.... dirty hack: assume fixed number of narration bits that can be found
if (triggered.Count == 13 && triggered.All(t => t.Value)) {
if (SteamManager.Initialized) {
SteamUserStats.SetAchievement("ALL_AUDIO");
Debug.Log("StoreStats(): " + SteamUserStats.StoreStats());
}
}
}
if (pronoun) {
if (SteamManager.Initialized) {
SteamUserStats.SetAchievement("PRONOUN");
Debug.Log("StoreStats(): " + SteamUserStats.StoreStats());
}
}
}
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using Steamworks;
[RequireComponent(typeof(RayCastTarget), typeof(BoxCollider))]
public class InfoActivatable : Activatable {
[TextArea(15,20)] public string text;
[TextArea(15, 20)] public string text_EN;
[TextArea(15,20)] public string text_EN;
Keyword myKeyword;
static Dictionary<string, bool> read;
private void Awake() {
myKeyword = GetComponent<Keyword>();
}
......@@ -18,18 +22,18 @@ public class InfoActivatable : Activatable {
Info.instance.Show(Menu.selectedLanguage==Menu.Language.ENGLISH?text_EN:text);
Reticule.instance.tutorial.SetActive(false);
myKeyword.enabled = false;
// achievement: check if all texts were read (dirty hack: check if a fixed number of texts was discovered)
read[text] = true;
if (read.Count == 17 && read.All(t => t.Value)) {
if (SteamManager.Initialized) {
SteamUserStats.SetAchievement("ALL_TEXT");
Debug.Log("StoreStats(): " + SteamUserStats.StoreStats());
}
}
}
public override void DeHover() {
myKeyword.enabled = true;
}
private void Start()
{
if (TextPrintManager.instance && TextPrintManager.instance.print)
{
TextPrintManager.instance.AddText(name+ "_engl", text_EN);
TextPrintManager.instance.AddText(name + "_ger", text);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.IO;
public class TextPrintManager : MonoBehaviour
{
public static TextPrintManager instance;
public Dictionary<string, string> textParts = new Dictionary<string, string>();
public bool print;
public bool doPrint;
public int nums;
private void Awake()
{
instance = this;
}
public void AddText(string nameandlang, string text)
{
if(!textParts.ContainsKey(nameandlang))textParts.Add(nameandlang, text);
nums = textParts.Count;
}
private void Update()
{
if (doPrint)
{
doPrint = false;
string path = "Assets/Resources/text.txt";
StreamWriter writer = new StreamWriter(path, true);
string s ="";
foreach(KeyValuePair<string,string> Elem in textParts)
{
s += Elem.Key + ": " + Elem.Value + "\n\n";
}
writer.Write(s);
writer.Close();
}
}
}
......@@ -20,7 +20,7 @@ public class TestSteam : MonoBehaviour
Debug.Log(SteamFriends.GetPersonaName());
m_GameID = new CGameID(SteamUtils.GetAppID());
Debug.Log("RequestCurrentStats(): " + SteamUserStats.RequestCurrentStats());
SteamUserStats.SetAchievement("START");
//SteamUserStats.SetAchievement("START");
Debug.Log("StoreStats(): " + SteamUserStats.StoreStats());
init = true;
}
......
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Steamworks;
public class TriggerAchievement : MonoBehaviour
{
public string achievementName;
private void OnTriggerEnter(Collider other) {
if (SteamManager.Initialized) {
SteamUserStats.SetAchievement(achievementName);
Debug.Log("StoreStats(): " + SteamUserStats.StoreStats());
}
}
}
fileFormatVersion: 2
guid: 3b1748e8e7ad57c48ba4b8980947d484
guid: 2728aca3481a5adf8b1657554bca2444
MonoImporter:
externalObjects: {}
serializedVersion: 2
......
Supports Markdown
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