mirror of
https://github.com/IvarK/AntimatterDimensionsSourceCode.git
synced 2024-11-22 04:05:42 +00:00
Steam-Specific Adjustments
This commit is contained in:
parent
f2604361be
commit
42be66000a
@ -72,6 +72,7 @@ class AchievementState extends GameMechanicState {
|
||||
GameUI.notify.reality(`Automatically unlocked: ${this.name}`);
|
||||
} else {
|
||||
GameUI.notify.success(`Achievement: ${this.name}`);
|
||||
SteamFunctions.GiveAchievement(this.id);
|
||||
}
|
||||
Achievements._power.invalidate();
|
||||
EventHub.dispatch(GAME_EVENT.ACHIEVEMENT_UNLOCKED);
|
||||
|
@ -14,6 +14,7 @@ export class GameOptions {
|
||||
// This is needed because .s-base--dark is on newUI/normal but not on oldUI/normal
|
||||
// So the classes on body need to be updated
|
||||
Themes.find(player.options.theme).set();
|
||||
SteamFunctions.UIZoom()
|
||||
GameStorage.save(true);
|
||||
}
|
||||
|
||||
|
@ -2,19 +2,20 @@ import LZString from "lz-string";
|
||||
|
||||
export function playFabLogin() {
|
||||
try {
|
||||
var authTicket = kongregate.services.getGameAuthToken();
|
||||
var requestData = {
|
||||
TitleId: titleId,
|
||||
KongregateId: kongregate.services.getUserId(),
|
||||
AuthTicket: authTicket,
|
||||
CreateAccount: true
|
||||
}
|
||||
try {
|
||||
PlayFab.ClientApi.LoginWithKongregate(requestData, playFabLoginCallback);
|
||||
} catch (e) {
|
||||
console.log("Unable to send login request to PlayFab.");
|
||||
}
|
||||
|
||||
Steam.getAuthSessionTicket(function(ticket){
|
||||
var SteamTicket = ticket.ticket.toString('hex')
|
||||
PlayFab.settings.titleId = "59813";
|
||||
var requestData = {
|
||||
TitleId: PlayFab.settings.titleId,
|
||||
SteamTicket: SteamTicket,
|
||||
CreateAccount: true
|
||||
};
|
||||
try {
|
||||
PlayFab.ClientApi.LoginWithSteam(requestData, playFabLoginCallback);
|
||||
} catch (e) {
|
||||
console.log("Unable to send login request to PlayFab.");
|
||||
}
|
||||
})
|
||||
/*
|
||||
// Dev playfab login
|
||||
titleId = "144";
|
||||
@ -34,21 +35,23 @@ export function playFabLogin() {
|
||||
}
|
||||
}
|
||||
|
||||
var titleId = "5695";
|
||||
var titleId = "59813";
|
||||
PlayFab.settings.titleId = "59813";
|
||||
var playFabId = -1
|
||||
|
||||
function playFabLoginCallback(data, error) {
|
||||
if (error) {
|
||||
console.log(error.errorMessage);
|
||||
GameUI.notify.error("Couldn't log in to PlayFab Cloud. You need to be logged in to Kongregate.");
|
||||
document.getElementById("cloudOptions").style.display = "none"
|
||||
document.getElementById("cloud").style.display = "none"
|
||||
GameUI.notify.error("Couldn't log in to PlayFab Cloud.");
|
||||
//document.getElementById("cloudOptions").style.display = "none"
|
||||
//document.getElementById("cloud").style.display = "none"
|
||||
return;
|
||||
}
|
||||
if (data) {
|
||||
//NOTE: SAVE 'playFabId' to a global variable somewhere, I just declare mine at the start of the playfab stuff. Use this variable to tell if your player is logged in to playfab or not.
|
||||
playFabId = data.data.PlayFabId;
|
||||
GameUI.notify.info("Logged in to PlayFab Cloud");
|
||||
PlayFab.ClientApi.UpdateUserTitleDisplayName({"DisplayName": Steam.getSteamId().screenName})
|
||||
|
||||
if (player.options.cloud) playFabLoadCheck()
|
||||
console.log("Logged in to playFab")
|
||||
@ -63,9 +66,9 @@ function saveToPlayFab(root) {
|
||||
if (chunks.length > 10) {
|
||||
GameUI.notify.error("Error saving to cloud: size limit exceeded");
|
||||
}
|
||||
|
||||
PlayFab.settings.titleId = "59813";
|
||||
var requestData = {
|
||||
TitleId: titleId,
|
||||
TitleId: PlayFab.settings.titleId,
|
||||
PlayFabId: playFabId,
|
||||
Data: chunks.mapToObject((_, index) => index, value => value)
|
||||
}
|
||||
@ -120,8 +123,9 @@ function loadFromPlayFabCallback(callback, data, error) {
|
||||
// Start: Migration
|
||||
if (data.data.Data.save) {
|
||||
var oldSave = JSON.parse(LZString.decompressFromEncodedURIComponent(data.data.Data.save.Value));
|
||||
PlayFab.settings.titleId = "59813";
|
||||
var requestData = {
|
||||
TitleId: titleId,
|
||||
TitleId: PlayFab.settings.titleId,
|
||||
PlayFabId: playFabId,
|
||||
// convert array into object with numbers as keys
|
||||
Data: {
|
||||
|
@ -467,7 +467,7 @@ GameDatabase.tabs = [
|
||||
name: "Shop",
|
||||
newUIClass: "shop",
|
||||
hideAt: 2.4,
|
||||
condition: () => kong.enabled || player.IAP.totalSTD > 0,
|
||||
condition: () => 1===1 /*kong.enabled || player.IAP.totalSTD > 0, ||*/,
|
||||
id: 10,
|
||||
hidable: true,
|
||||
subtabs: [
|
||||
|
@ -54,6 +54,7 @@ export const GameStorage = {
|
||||
this.loadPlayerObject(this.saves[slot]);
|
||||
Tabs.all.find(t => t.id === player.options.lastOpenTab).show(true);
|
||||
GameUI.notify.info("Game loaded");
|
||||
SteamFunctions.BackfillAchievements()
|
||||
},
|
||||
|
||||
import(saveData, overrideLastUpdate = undefined) {
|
||||
@ -70,6 +71,7 @@ export const GameStorage = {
|
||||
if (player.speedrun?.isActive) Speedrun.setSegmented(true);
|
||||
this.save(true);
|
||||
GameUI.notify.info("Game imported");
|
||||
SteamFunctions.BackfillAchievements()
|
||||
},
|
||||
|
||||
importAsFile() {
|
||||
|
@ -1054,8 +1054,10 @@ window.onload = function() {
|
||||
GameUI.initialized = supportedBrowser;
|
||||
ui.view.initialized = supportedBrowser;
|
||||
setTimeout(() => {
|
||||
if (kong.enabled) {
|
||||
playFabLogin();
|
||||
if(Steam){
|
||||
if(Steam.initAPI()){
|
||||
playFabLogin();
|
||||
}
|
||||
}
|
||||
document.getElementById("loading").style.display = "none";
|
||||
document.body.style.overflowY = "auto";
|
||||
@ -1093,6 +1095,7 @@ export function init() {
|
||||
GameStorage.load();
|
||||
Tabs.all.find(t => t.config.id === player.options.lastOpenTab).show(true);
|
||||
kong.init();
|
||||
if(steamOn){SteamFunctions.UIZoom()}
|
||||
}
|
||||
|
||||
window.tweenTime = 0;
|
||||
|
@ -52,6 +52,7 @@
|
||||
<script>
|
||||
/*--Post GameLoad Steam Initialization--*/
|
||||
var nodeOn = window.require!==undefined ? true : false
|
||||
steamOn=true //change to false!!
|
||||
if(nodeOn){
|
||||
var JQ = require('jquery');
|
||||
var Steam = require('greenworks')
|
||||
@ -72,6 +73,7 @@
|
||||
}else{
|
||||
}
|
||||
}
|
||||
console.log("SteamOn is "+steamOn) //REMOVE! JUST FOR TESTING
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
|
@ -21,23 +21,23 @@ export default {
|
||||
<div class="c-modal-store-buttons">
|
||||
<StdStoreRow
|
||||
:amount="20"
|
||||
:cost="20"
|
||||
:cost="1.99"
|
||||
/>
|
||||
<StdStoreRow
|
||||
:amount="60"
|
||||
:cost="50"
|
||||
:cost="4.99"
|
||||
/>
|
||||
<StdStoreRow
|
||||
:amount="140"
|
||||
:cost="100"
|
||||
:cost="9.99"
|
||||
/>
|
||||
<StdStoreRow
|
||||
:amount="300"
|
||||
:cost="200"
|
||||
:cost="19.99"
|
||||
/>
|
||||
<StdStoreRow
|
||||
:amount="1000"
|
||||
:cost="500"
|
||||
:cost="49.99"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -13,7 +13,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
purchase() {
|
||||
kong.buyMoreSTD(this.amount, this.cost);
|
||||
SteamFunctions.PurchaseIAP(this.amount, this.cost);
|
||||
}
|
||||
},
|
||||
|
||||
@ -29,7 +29,7 @@ export default {
|
||||
class="o-modal-store-btn"
|
||||
@click="purchase"
|
||||
>
|
||||
<span>{{ cost }}</span><img src="images/kred_single.png">
|
||||
<span>{{ cost }}</span><!--img src="images/kred_single.png"-->
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -17,7 +17,7 @@ export default {
|
||||
return ShopPurchase.all;
|
||||
},
|
||||
buySTDText() {
|
||||
return this.kongEnabled ? "Buy More" : "Play in Kongregate to buy STDs";
|
||||
return steamOn ? "Buy More" : "Play Online on Steam to buy STDs";
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@ -26,7 +26,7 @@ export default {
|
||||
this.kongEnabled = kong.enabled;
|
||||
},
|
||||
showStore() {
|
||||
if (!this.kongEnabled) return;
|
||||
if (!steamOn) return;
|
||||
Modal.shop.show();
|
||||
},
|
||||
buyTimeSkip() {
|
||||
|
Loading…
Reference in New Issue
Block a user