Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 72 lines (65 sloc) 2.541 kb
7134af0b »
2012-03-25 initial version
1 package
2 {
3 import com.amanitadesign.steam.FRESteamWorks;
4 import com.amanitadesign.steam.SteamConstants;
5 import com.amanitadesign.steam.SteamEvent;
6
7 import flash.display.SimpleButton;
8 import flash.display.Sprite;
9 import flash.events.MouseEvent;
10 import flash.text.TextField;
11
12 public class FRESteamWorksTest extends Sprite
13 {
14 public var Steamworks:FRESteamWorks = new FRESteamWorks();
15 public var tf:TextField;
16 public function FRESteamWorksTest()
17 {
18 tf = new TextField();
19 tf.width = stage.stageWidth;
20 tf.height = stage.stageHeight;
21 addChild(tf);
22
23 tf.addEventListener(MouseEvent.MOUSE_DOWN, onClick);
24
25 Steamworks.addEventListener(SteamEvent.STEAM_RESPONSE, onSteamResponse);
26
27 if(Steamworks.init()){
28 tf.appendText(" joooooooooo\n");
29 tf.appendText("isAchievement('ACH_WIN_ONE_GAME') == "+Steamworks.isAchievement("ACH_WIN_ONE_GAME")+"\n");
30 tf.appendText("isAchievement('ACH_TRAVEL_FAR_SINGLE') == "+Steamworks.isAchievement("ACH_TRAVEL_FAR_SINGLE")+"\n");
31 tf.appendText("setStatFloat('FeetTraveled') == "+Steamworks.setStatFloat('FeetTraveled', 21.3)+"\n");
32 tf.appendText("setStatInt('NumGames', 2) == "+Steamworks.setStatInt('NumGames', 2)+"\n");
33 Steamworks.storeStats();
34 tf.appendText("getStatInt('NumGames') == "+Steamworks.getStatInt('NumGames')+"\n");
35 tf.appendText("getStatFloat('FeetTraveled') == "+Steamworks.getStatFloat('FeetTraveled')+"\n");
36
37 //Steamworks.clearAchievement("ACH_WIN_ONE_GAME");
38 //Steamworks.requestStats();
39 Steamworks.resetAllStats(true);
40 }else {
41 tf.appendText(" neeeeee\n");
42 }
43
44 }
45 public function onClick(e:MouseEvent):void{
46 if(Steamworks.isReady){
47 if(!Steamworks.isAchievement("ACH_WIN_ONE_GAME")) {
48 tf.appendText("setting.. ACH_WIN_ONE_GAME\n");
49 Steamworks.setAchievement("ACH_WIN_ONE_GAME");
50 }
51 //Steamworks.storeStats();
52 } else {
53 tf.appendText("not able to set achievement\n");
54 }
55 }
56 public function onSteamResponse(e:SteamEvent):void{
57 switch(e.req_type){
58 case SteamConstants.RESPONSE_OnUserStatsStored:
59 tf.appendText("RESPONSE_OnUserStatsStored: "+e.response+"\n");
60 break;
61 case SteamConstants.RESPONSE_OnUserStatsReceived:
62 tf.appendText("RESPONSE_OnUserStatsReceived: "+e.response+"\n");
63 break;
64 case SteamConstants.RESPONSE_OnAchievementStored:
65 tf.appendText("RESPONSE_OnAchievementStored: "+e.response+"\n");
66 break;
67 default:
68 tf.appendText("STEAMresponse type:"+e.req_type+" response:"+e.response+"\n");
69 }
70 }
71 }
72 }
Something went wrong with that request. Please try again.