public void LoadCharacterBio(int charIdx, PersistData pers) { XmlNode bio = characterBios[charIdx]; headerText.text = bio.Attributes["name"].InnerText; int actIdx = int.Parse(bio.Attributes["idx"].InnerText); string res = ""; if (actIdx < 0) { res = bio.SelectSingleNode("bio").InnerText; characters.SetActive(false); } else { characters.SetActive(true); int displayIdx = actIdx >= 10 ? (actIdx + 20) : (actIdx * 3 + Random.Range(0, 1 + pers.GetSaveData().getPlayerWinType(pers.GetPlayerSpritePathFromInt(actIdx)))); characters.GetComponent <SpriteRenderer>().sprite = charSheet[displayIdx]; res = GetXmlValue("age") + ": " + bio.SelectSingleNode("age").InnerText; res += "\n\n" + GetXmlValue("likes") + ": " + bio.SelectSingleNode("likes").InnerText; res += "\n\n" + GetXmlValue("dislikes") + ": " + bio.SelectSingleNode("dislikes").InnerText; res += "\n\n" + bio.SelectSingleNode("bio").InnerText; } infoPaneTextRight.text = res; infoPaneTextRight.text = GetWrappedString(infoPaneTextRight, res, bounds); }
public BlockHandler(PersistData PD, int lv) { gameType = PD.gameType; balloonNum = (PD.p2Char == PersistData.C.FuckingBalloon)?2:(PD.p1Char == PersistData.C.FuckingBalloon)?1:-1; balloonType = PD.balloonType; isTutorial = PD.isTutorial; if (gameType == PersistData.GT.Challenge) { SetupPlayerInts(); SetupTilesForPuzzle(lv); } else if (gameType != PersistData.GT.Training || !isTutorial) { vals = new List <int>(); SetupPlayerInts(); for (int i = 0; i < 50; i++) { vals.Add(Random.Range(0, 3)); } } else { if (isTutorial) { SetupPlayerInts(); SetupTilesForPuzzle(0); } } }
public void InitFromPersistString(string str) { PersistData data = null; try { if (str.Length > GetType().ToString().Length) { var reader = new StringReader(str.Substring(GetType().ToString().Length)); System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(PersistData)); data = (PersistData)xs.Deserialize(reader); reader.Close(); } } catch (System.Xml.XmlException) { } catch (InvalidOperationException) { // don't need to handle it. Leave data null and pick up defaults below } if (data == null || data.persistVersion != PersistData.currentPersistVersion) { data = PersistData.GetDefaults(eventView); } ApplyPersistData(data); }
public BlockHandler(PersistData PD, int lv, bool setSeed = false, int seed = 0) { gameType = PD.gameType; balloonNum = (PD.p2Char == PersistData.C.FuckingBalloon)?2:(PD.p1Char == PersistData.C.FuckingBalloon)?1:-1; balloonType = PD.balloonType; isTutorial = PD.isTutorial; if (setSeed) { useSysRandom = true; myBaby = new System.Random(seed); } if (gameType == PersistData.GT.Challenge) { SetupPlayerInts(); SetupTilesForPuzzle(lv); } else if (gameType != PersistData.GT.Training || !isTutorial) { vals = new List <int>(); SetupPlayerInts(); for (int i = 0; i < 50; i++) { vals.Add(Rand()); } } else { if (isTutorial) { SetupPlayerInts(); SetupTilesForPuzzle(0); } } }
public void PersistData_LoadStream_CanReadSaveStream() { // Arrange string streamName = "EventStream1"; var cashDeskStream = new CashDesk.Server.CashDeskEventStream() { StreamName = "EventStream1" }; var dataEventsPersistence = new DataEventsPersistenceMock(); cashDeskStream.AddTransaction(new Server.Entities.CashDeskTransaction( new DateTime(2021, 05, 05), "HAMMER", "Test", 20.12m, "1")); var dataPersistence = new PersistData <CashDesk.Server.CashDeskEventStream>(dataEventsPersistence); // Act dataPersistence.Save <DataCashDeskTransactionAddedEvent, CashDeskTransactionAddedEvent>(cashDeskStream); var result = dataPersistence.Load(streamName); // Assert Assert.Equal(streamName, result.StreamName); Assert.Equal(20.12m, result.CashDeskBalance["1"]); }
public void SetupTile(PersistData P, Vector3 pos, Sprite[] ts, Sprite os, Sprite[] ss, int tVal, int sVal, bool show) { PD = P; ColorHalf = new Color(1.0f, 1.0f, 1.0f, 0.5f); tileSheet = ts; glowSheet = Resources.LoadAll <Sprite>(SpritePaths.Glows); emptySpriteTile = 3; isShown = show; isEmpty = false; colorVal = tVal; specialVal = sVal; clearBackOnOverlayWipe = false; isShield = false; flashState = -1; if (isShown) { int tValAct = (tVal < 0?emptySpriteTile:tVal); block = GetTileObject(pos, "tile", ts[tValAct], "Tile"); block_sr = block.GetComponent <SpriteRenderer>(); charoverlay = GetTileObject(pos, "tile", os, "TileOverlay"); charoverlay.transform.parent = block.transform; shape = GetTileObject(pos, "tile", ss[GetShapeIdx(tValAct, sVal)], "Shape"); shape.transform.parent = block.transform; shape_sr = shape.GetComponent <SpriteRenderer>(); if (tValAct == emptySpriteTile) { shape.SetActive(false); } } if (tVal > 2 || tVal < 0) { Kill(); } }
public void Init(PersistData p, int type, int length, Vector3 topPos, float topDest, bool mirror = false) { PD = p; dead = false; tileType = type; maxY = topDest + (mirror ? ((length - 1) * Consts.TILE_SIZE + 0.6f) : Consts.TILE_SIZE); up = topDest > topPos.y; Sprite[] sheet = Resources.LoadAll <Sprite> (SpritePaths.Zapper); zappers = new List <GameObject>(); Vector3 newPos = topPos; GameObject top = GetGameObject(newPos); top.renderer.sortingLayerName = "Zapper"; top.GetComponent <SpriteRenderer>().sprite = sheet[type]; top.transform.parent = gameObject.transform; zappers.Add(top); for (int i = 2; i < length; i++) { newPos.y -= ZAP_SIZE; GameObject middlin = GetGameObject(newPos); middlin.GetComponent <SpriteRenderer>().sprite = sheet[type + 3]; middlin.renderer.sortingLayerName = "Zapper"; middlin.transform.parent = gameObject.transform; zappers.Add(middlin); } newPos.y -= ZAP_SIZE; GameObject bottom = GetGameObject(newPos); bottom.GetComponent <SpriteRenderer>().sprite = sheet[type + 6]; bottom.transform.parent = gameObject.transform; bottom.renderer.sortingLayerName = "Zapper"; zappers.Add(bottom); EENs = new List <EENdeets>(); EEN = Resources.LoadAll <Sprite>(SpritePaths.Launch_Particles)[type]; }
public void InitializeMembers(TextMesh h, PersistData p) { headerText = h; PD = p; texts = new List <TextMesh>(); colliders = new List <GameObject>(); optionInfos = new List <OptionMinMaxInfo>(); }
void Awake() { rb = GetComponent <Rigidbody2D>(); anim = GetComponent <Animator>(); myBodyCollider = GetComponent <CapsuleCollider2D>(); myFeetCollider = GetComponent <BoxCollider2D>(); persistData = FindObjectOfType <PersistData>(); }
public CampaignHandler(PersistData p, BoardWarSpecial b1, BoardWarCampaign b2, BoardMirrorSpecial m, BoardCursorWar c1, BoardCursorBot c2, CampaignHUD h, XmlNode top) { PD = p; hud = h; mirror2 = m; board1 = b1; board2 = b2; cursor1 = c1; cursor2 = c2; inCampaignShop = false; playerDied = false; navDetails = top; }
public void SetToBiosPanel(int pos, PersistData pers) { goBack.SetActive(false); infoPaneFunFact.text = ""; infoPaneTextCenter.text = ""; infoPaneTextLeft.text = ""; LoadCharacterBio(pos, pers); }
public async Task <PersistData> SetPersistData([FromBody] SetDataRequest request) { var game = (await gameRepository.Lookup(request.gameLookup)).FirstOrDefault(); if (game == null) { throw new ArgumentException(); } var profile = (await profileRepository.Lookup(request.profileLookup)).FirstOrDefault(); if (profile == null) { throw new NoSuchUserException(); } var lookup = new PersistDataLookup(); lookup.profileLookup = request.profileLookup; lookup.gameLookup = request.gameLookup; lookup.DataIndex = request.dataIndex; lookup.PersistType = request.persistType; //delete request PersistData data_entry = null; if (request.base64Data.Length == 0) { bool success = await persistRepository.Delete(lookup); //if(success) { var data = new PersistData(); data.Modified = DateTime.UtcNow; data.Profile = profile; return(data); } } else { data_entry = (await persistRepository.Lookup(lookup)).FirstOrDefault(); if (data_entry != null) { data_entry.Base64Data = Convert.FromBase64String(request.base64Data); return(await persistRepository.Update(data_entry)); } else { var data = new PersistData(); data.Base64Data = Convert.FromBase64String(request.base64Data); data.DataIndex = request.dataIndex; data.PersistType = request.persistType; data.Profileid = profile.Id; data.Gameid = game.Id; return(await persistRepository.Create(data)); } } }
public OnlinePlayer(BoardWar mine, BoardWar theirs, BoardCursorActualCore cursor) : base(mine, theirs, cursor) { state = 0; GameObject Persist = GameObject.Find("PersistData") as GameObject; PD = Persist.GetComponent <PersistData>(); opponent = (CSteamID)PD.onlineOpponentId; actionQueue = new List <AIAction>(); }
private string PersistString() { var writer = new StringWriter(); writer.Write(GetType().ToString()); PersistData data = PersistData.GetDefaults(eventView); System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(PersistData)); xs.Serialize(writer, data); return(writer.ToString()); }
public void Setup(PersistData P) { PD = P; lastCheck = Time.time; goDisplayed = false; isDoneAnimating = false; countdownState = 0; display = Instantiate(PD.universalPrefab, Vector3.zero, Quaternion.identity) as GameObject; display.renderer.sortingLayerName = "Cover HUD Dialog Text"; display.name = "Countdown"; textSprites = Resources.LoadAll <Sprite>(SpritePaths.Texts); display.GetComponent <SpriteRenderer>().sprite = textSprites[2]; PD.sounds.SetVoiceAndPlay(SoundPaths.NarratorPath + "019", 0); }
public static PersistData GetDefaults(TreelistView.TreeListView view) { PersistData data = new PersistData(); foreach (var c in view.Columns) { ColumnArrangement a = new ColumnArrangement(); a.fieldname = c.Fieldname; a.visibleindex = c.VisibleIndex; a.width = c.Width; data.visibleColumns.Add(a); } return(data); }
// Use this for initialization void Awake() { GameFilePath = Application.persistentDataPath + "/userData"; GameFileName = "/default.dat"; // Singelton - There can be only one... if (instance == null) { DontDestroyOnLoad(gameObject); instance = this; } else if (instance != this) { Destroy(gameObject); } }
public PlayerDataTextWriter(TextMesh h, TextMesh c, TextMesh l, TextMesh r, TextMesh ff, List <XmlNode> cb, XmlNode top, GameObject ch, GameObject gb, PersistData p) { headerText = h; infoPaneTextCenter = c; infoPaneTextLeft = l; infoPaneTextRight = r; infoPaneFunFact = ff; sd = p.GetSaveData(); characterBios = cb; characters = ch; goBack = gb; goBack.SetActive(false); navDetails = top; charSheet = Resources.LoadAll <Sprite>(SpritePaths.CharFullShots); PD = p; bounds = new Vector2(2.4f, 3.0f); }
public void PersistData_Load() { // Arrange string streamName = "EntityStream1"; string eventType = typeof(DataCashDeskTransactionAddedEvent).AssemblyQualifiedName; var changes = new List <DataCashDeskTransactionAddedEvent>() { new DataCashDeskTransactionAddedEvent() { EventType = eventType, Transaction = new Server.Entities.CashDeskTransaction(new DateTime(2021, 02, 05), "HAMMER", "Claw Hammer", 20.43m, "1") }, new DataCashDeskTransactionAddedEvent() { EventType = eventType, Transaction = new Server.Entities.CashDeskTransaction(new DateTime(2021, 02, 05), "NAIL2_5", "2.5mm NAILS (100)", 0.94m, "1") }, new DataCashDeskTransactionAddedEvent() { EventType = eventType, Transaction = new Server.Entities.CashDeskTransaction(new DateTime(2021, 02, 05), "NAIL1_8", "1.8mm NAILS (250)", 2.01m, "1") } }; var cashDeskReturnStream = new CashDesk.Server.CashDeskEventStream() { Changes = changes.Select(a => (object)a).ToList(), StreamName = streamName }; var returnStreamSerialised = JsonConvert.SerializeObject(cashDeskReturnStream); var dataEventsPersistence = Substitute.For <DataPersistence.IDataEventsPersistence>(); dataEventsPersistence.Read(Arg.Is <string>(streamName)).Returns(new[] { returnStreamSerialised }); var dataPersistence = new PersistData <CashDesk.Server.CashDeskEventStream>(dataEventsPersistence); // Act var result = dataPersistence.Load(streamName); // Assert Assert.Equal(streamName, result.StreamName); Assert.Equal(23.38m, result.CashDeskBalance["1"]); }
public CutsceneChar(string n, GameObject o, Sprite[] s, int p, PersistData PD, bool gameChar = false) { if (n == "Doug") { PD.AlterSound(); } _name = PD.GetPlayerDisplayName(n); _path = n; _obj = o; _obj_sr = _obj.GetComponent <SpriteRenderer>(); _baseColor = _obj_sr.color; _sheet = s; _player = p; _PD = PD; inGame = gameChar; sheetScale = new Vector3(_obj.transform.localScale.x, _obj.transform.localScale.y); loseFrame = 5; hidden = false; localy = o.transform.localPosition.y; }
public void PersistData_Save() { // Arrange string streamName = "EntityStream1"; var dataEventsPersistence = Substitute.For <DataPersistence.IDataEventsPersistence>(); var cashDesk = new CashDesk.Server.CashDeskEventStream() { StreamName = streamName }; var dataPersistence = new PersistData <CashDesk.Server.CashDeskEventStream>(dataEventsPersistence); cashDesk.AddTransaction(new Server.Entities.CashDeskTransaction(new DateTime(2021, 02, 05), "HAMMER", "Claw Hammer", 20.43m, "1")); cashDesk.AddTransaction(new Server.Entities.CashDeskTransaction(new DateTime(2021, 02, 05), "NAIL2_5", "2.5mm NAILS (100)", 0.94m, "1")); cashDesk.AddTransaction(new Server.Entities.CashDeskTransaction(new DateTime(2021, 02, 05), "NAIL1_8", "1.8mm NAILS (250)", 2.01m, "1")); // Act dataPersistence.Save <DataCashDeskTransactionAddedEvent, CashDeskTransactionAddedEvent>(cashDesk); // Assert dataEventsPersistence.Received(1).Append(Arg.Is <string>(streamName), Arg.Any <string>()); }
void Awake() { //If I am the first instance, make me the Singleton if (singleton == null) { singleton = this; DontDestroyOnLoad(this); } // If a Singleton already exists and you find another // reference in scene, destroy it! else { if (this != singleton) { Destroy(this.gameObject); } } // set variables // Domain reference domain = host; // ESIa Services Variables esia_domain = host + "/ESIa/"; url_esia_getgamelist = esia_domain + "GetAllGamesList/"; url_esia_login = esia_domain + "login/"; url_esia_getgamedata = esia_domain + "GetOpenGameData/"; // CGR Services Variables cgr_domain = host + "/CloudGameReport/services/"; url_cgr_login = cgr_domain + "login/"; url_cgr_availableClasses = cgr_domain + "ListOfAvailableClasses/"; url_cgr_requestSubscription = cgr_domain + "SubscribeToClass/"; url_cgr_subscribedClasses = cgr_domain + "ListOfSubscribedGameEntries/"; url_cgr_saveData = cgr_domain + "Save/"; }
private void ApplyPersistData(PersistData data) { // loop twice because first time will ensure the right columns are visible but // e.g. if the first column we grabbed should be in visibleindex 2, it would // get shown and be forced to 0 (arbitrary example). Second pass ensures the // order is correct for (int i = 0; i < 2; i++) { foreach (var c in data.visibleColumns) { var col = eventView.Columns[c.fieldname]; if (col == null) { continue; } eventView.Columns.SetVisibleIndex(col, c.visibleindex); if (i == 1) { col.Width = c.width; } } } }
public static PersistData GetDefaults() { PersistData data = new PersistData(); data.meshView = true; return data; }
public void SaveScore(Score score) { persistData = new PersistData(); persistData.PersistScore(new ScoreDAO(score)); }
public static PersistData GetDefaults() { PersistData data = new PersistData(); data.panelLayout = ""; return data; }
private void ApplyPersistData(PersistData data) { MeshView = data.meshView; onloadLayout = data.panelLayout; }
protected void GetPersistData() { GameObject Persist = GameObject.Find("PersistData") as GameObject; PD = Persist.GetComponent <PersistData>(); }
private void ApplyPersistData(PersistData data) { onloadLayout = data.panelLayout; darkBack = data.darkBack; lightBack = data.lightBack; }
private string PersistString() { var writer = new StringWriter(); writer.Write(GetType().ToString()); PersistData data = new PersistData(); // passing in a MemoryStream gets disposed - can't see a way to retrieve this // in-memory. var enc = new UnicodeEncoding(); var path = Path.GetTempFileName(); dockPanel.SaveAsXml(path, "", enc); try { data.panelLayout = File.ReadAllText(path, enc); File.Delete(path); } catch (System.Exception) { // can't recover return writer.ToString(); } data.darkBack = darkBack; data.lightBack = lightBack; System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(PersistData)); xs.Serialize(writer, data); return writer.ToString(); }
// note that raw buffer viewers do not persist deliberately private string PersistString() { if (!MeshView) return ""; var writer = new StringWriter(); writer.Write(GetType().ToString()); PersistData data = new PersistData(); data.meshView = MeshView; System.Xml.Serialization.XmlSerializer xs = new System.Xml.Serialization.XmlSerializer(typeof(PersistData)); xs.Serialize(writer, data); return writer.ToString(); }
public static PersistData GetDefaults(TreelistView.TreeListView view) { PersistData data = new PersistData(); foreach (var c in view.Columns) { ColumnArrangement a = new ColumnArrangement(); a.fieldname = c.Fieldname; a.visibleindex = c.VisibleIndex; a.width = c.Width; data.visibleColumns.Add(a); } return data; }
public static PersistData GetDefaults() { PersistData data = new PersistData(); data.panelLayout = ""; data.darkBack = new FloatVector(0, 0, 0, 0); data.lightBack = new FloatVector(0, 0, 0, 0); return data; }
private void ApplyPersistData(PersistData data) { MeshView = data.meshView; }
private void ApplyPersistData(PersistData data) { onloadLayout = data.panelLayout; }
public ScoreTextFormatter(PersistData p) { PD = p; }
private void ApplyPersistData(PersistData data) { // loop twice because first time will ensure the right columns are visible but // e.g. if the first column we grabbed should be in visibleindex 2, it would // get shown and be forced to 0 (arbitrary example). Second pass ensures the // order is correct for (int i = 0; i < 2; i++) { foreach (var c in data.visibleColumns) { var col = eventView.Columns[c.fieldname]; if (col == null) continue; eventView.Columns.SetVisibleIndex(col, c.visibleindex); if (i == 1) col.Width = c.width; } } }
public void SetPD(PersistData p) { PD = p; }