// upoffset } public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (cannon && N.GetKeys().Contains(ConveyerWhoosherSpeeder.speedKey)) { GetComponentInChildren <ConveyerWhoosherSpeeder>().speed = N[ConveyerWhoosherSpeeder.speedKey].AsInt; } /* * Format of properties for the NumberModifiers may differ, look in NumberHoop for the actual implementation of this method. * */ // // commented Debug.Log("props:"+props); // SimpleJSON.JSONNode n = SimpleJSON.JSON.Parse(props); // // commented Debug.Log("set prop received:"+N.ToString()); if (textTrigger && N.GetKeys().Contains(PlayerNowMessageTrigger.textTriggerKey)) { PlayerNowMessageTrigger tt = GetComponentInChildren <PlayerNowMessageTrigger>(); if (tt) { tt.thingToSay = Utils.FakeToRealQuotes(N[PlayerNowMessageTrigger.textTriggerKey].Value); } else { // commented Debug.LogError("Set prop fail, no speech, couldn't say '"+N[PlayerNowMessageTrigger.textTriggerKey].Value+"' on "+myName); } } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(sizeKey) && N.GetKeys().Contains(deactivatedCubesArrayKey)) { puzzleSize = JsonUtil.StringToIntVector3(N[sizeKey].Value); SetPuzzleSize((int)puzzleSize.x, (int)puzzleSize.y, (int)puzzleSize.z); // creates a solid block of cubes // deactivate // deactivates cubes to show the pattern (a user had previously deactivated select cubes and "saved" the puzzle in that state) List <Vector3> deactivatedCubesList = new List <Vector3>(); foreach (SimpleJSON.JSONNode v3 in N[deactivatedCubesArrayKey].AsArray.Childs) { if (v3.Value == "") { continue; } // else Debug.Log("v3 val:"+v3.Value+", len;"+v3.Value.Length); Vector3 v3actual = JsonUtil.StringToIntVector3(v3.Value); deactivatedCubesList.Add(v3actual); // Debug.Log("add;"+v3actual); } // Debug.Log("deact cube list ct:"+deactivatedCubesList.Count); foreach (DanMeyerCube dmc in cubes) { // Debug.Log("compare:"+dmc.indexedPosition + " ==== "+deactivatedCubesList[0]); if (deactivatedCubesList.Contains(dmc.indexedPosition)) // note that int vector3 may be problem e.g. vector3(0,1,2) != vector3(0.0001,2,3) // Debug.Log("MATCH"); { dmc.TurnCubeOff(true); } } } UpdateCountText(); }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(wallCreatorRoundKey)) { SetPropertiesSize(N); } if (N.GetKeys().Contains(Fraction.fractionKey)) { SetFraction(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N)); } }
// public override void SetFraction(string fraction){ // // nothing this doesn't have fraction. // } public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); // // commented Debug.Log("set prop on obj:"+name+", prop:"+N.ToString()); if (N.GetKeys().Contains(wallCreatorSquareKey)) { SetPropertiesSize(N); } // move following to base.setprop? if (N.GetKeys().Contains(Fraction.fractionKey)) { SetFraction(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N)); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); // we use the generic fraction key. // Debug.Log("setprop endoor:"+N.ToString()); if (N.GetKeys().Contains(Fraction.fractionKey)) { SetMaxCharge(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N)); } // For setting current charge we use the specific key (this can't be set during level builder editing mode) if (N.GetKeys().Contains(LevelMachineBattery.currentChargeKey)) { SetCurrentCharge(JsonUtil.ConvertJsonToFraction(LevelMachineBattery.currentChargeKey, N)); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); NumberInfo ni = GetComponentInChildren <NumberInfo>(); if (N.GetKeys().Contains(Fraction.fractionKey)) { if (ni) { ni.SetNumber(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N)); } else { Debug.Log("ERROR: no number in this flower!:" + name); } } else { if (ni) { NumberManager.inst.DestroyOrPool(ni); // Destroy(ni.gameObject); // this flower shouldn't exist, but was included with the prefab .. so we destroy it after placement because json says it shouldn't have a numberinfo } else { Debug.Log("ERROR: no number in this flower!:" + name); } } }
public void SetProperties(SimpleJSON.JSONClass N) { if (N.GetKeys().Contains(JsonUtil.scaleKey)) { origScale = JsonUtil.GetScaleFromInt(N[JsonUtil.scaleKey].AsInt); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (GetComponentInChildren <NumberInfo>()) { if (N.GetKeys().Contains(Fraction.fractionKey)) { Fraction newFrac = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N); GetComponentInChildren <NumberInfo>().SetNumber(newFrac); // should only be one (for the starting case...) } // if (N.GetKeys().Contains(typeKey)){ // EDIT we're going to just have 2 prefabs, its easier // if (N[typeKey] == SnailType.Factors.ToString()){ // type = SnailType.Factors; // } else if (N[typeKey] == SnailType.Multiples.ToString()){ // type = SnailType.Multiples; // } // } // if (N.GetKeys() } else { Debug.LogWarning("Monster blob had no number to set props to!"); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(Fraction.fractionKey)) { SetPropertiesFraction(N); } if (N.GetKeys().Contains(offsetKey)) { SetOffset(N[offsetKey].AsFloat); } if (N.GetKeys().Contains(intervalKey)) { interval = N[intervalKey].AsFloat; } }
// Freshly populate the placed objects // public List<LevelBuilderSelectableObject> GetPlacedObjects(SceneSerializationType type){ // LevelBuilderSelectableObject // return ueos; // } public UserEditableObject PlaceObject(SimpleJSON.JSONClass N, SceneSerializationType type, int uuid = -1) { // Debug.Log("placing:"+N["name"]); GameObject objToPlace = GetPrefabInstanceFromName(N["name"].Value); bool objActiveState = true; if (N.GetKeys().Contains("active")) { // Debug.Log("obj active;"+N["active"].ToString()); objActiveState = N["active"].AsBool; // if the object has this information, it might have been inactive when it was serialized. } if (objToPlace == null) { Debug.Log("<color=red>obj null</color>:" + N["name"]); return(null); } objToPlace.transform.position = JsonUtil.GetRealPositionFromTruncatedPosition(N); // objToPlace.name += Random.Range(0,100000); objToPlace.transform.rotation = JsonUtil.GetRealRotationFromJsonRotation(N); SimpleJSON.JSONClass props = (SimpleJSON.JSONClass)N["properties"]; UserEditableObject ueo = objToPlace.GetComponent <UserEditableObject>(); if (uuid != -1) { props[UserEditableObject.uuidKey].AsInt = uuid; } else if (N.GetKeys().Contains(UserEditableObject.uuidKey)) { props[UserEditableObject.uuidKey].AsInt = N[UserEditableObject.uuidKey].AsInt; } ueo.OnLevelBuilderObjectCreated(); ueo.SetProperties(props); if (LevelBuilder.inst.levelBuilderIsShowing) { ueo.OnLevelBuilderObjectPlaced(); } if (!objActiveState) { objToPlace.SetActive(objActiveState); } // Debug.Log("Built;"+ueo.name+"at :"+ueo.transform.position); return(ueo); }
public Dictionary<string, string> GetDictionary(JSONClass N) { Dictionary<string, string> d = new Dictionary<string, string>(); foreach (string key in N.GetKeys()) { d.Add(key, N[key]); } return d; }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(CostumeController.beardColorKey)) { // if it has one costume controller key, it has them all, so we just check one -- beard. cc.SetProperties(N); } }
void SetPropertiesFraction(SimpleJSON.JSONClass N) { if (N.GetKeys().Contains(fractionLowerKey)) { lowerFrac = JsonUtil.ConvertJsonToFraction(fractionLowerKey, N); } if (N.GetKeys().Contains(fractionUpperKey)) { upperFrac = JsonUtil.ConvertJsonToFraction(fractionUpperKey, N); } foreach (NumberInfo ni in GetComponentsInChildren <NumberInfo>()) { Fraction f = GetFractionFromIndex(0); ni.SetNumber(f, false, false); } // // commented Debug.Log("setting FRAC prop:"+frac); }
public override void SetProperties(SimpleJSON.JSONClass N) { // WebGLComm.inst.Debug("Sheep trigger set prop:"+N.ToString()); base.SetProperties(N); if (N.GetKeys().Contains(Fraction.fractionKey)) { sheepTrigger.sheepNeeded = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N); } }
override public void OnMenuOpened() { SimpleJSON.JSONClass N = LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().GetProperties(); if (N.GetKeys().Contains(LinkLevelPortalPipe.linkLevelKey)) { levelCodeText.text = N[LinkLevelPortalPipe.linkLevelKey][LinkLevelPortalPipe.portalDestinationKey].Value; levelNameText.text = N[LinkLevelPortalPipe.linkLevelKey][LinkLevelPortalPipe.portalNameKey].Value; } }
// upoffset } public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(Fraction.fractionKey)) { frac = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N); ElevatorMoveTo(frac); } if (N.GetKeys().Contains(NumberRiser.heightScaleKey)) { SetScale(N[NumberRiser.heightScaleKey].AsFloat); } /* * Format of properties for the NumberModifiers may differ, look in NumberHoop for the actual implementation of this method. * */ // SimpleJSON.JSONNode n = SimpleJSON.JSON.Parse(props); }
public void OnMenuOpened() { SimpleJSON.JSONClass N = LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().GetProperties(); // commented Debug.Log("N.tostr:"+N.ToString()); if (N.GetKeys().Contains(NumberRiser.heightScaleKey)) { numerator.text = Fraction.GetFractionFromFloat(N[NumberRiser.heightScaleKey].AsFloat).numerator.ToString(); denominator.text = Fraction.GetFractionFromFloat(N[NumberRiser.heightScaleKey].AsFloat).denominator.ToString(); } }
public void SetProperties(SimpleJSON.JSONClass N) { // Debug.Log("N:"+N.ToString()); if (N.GetKeys().Contains(key)) { frac = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, (SimpleJSON.JSONClass)N[key]); dropped = N[key][droppedKey].AsBool; // WebGLComm.inst.Debug("Set prop on resource;"+N.ToString()); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(JsonUtil.dimensionsKey)) { DeleteFloor(); SetupFloor(N[JsonUtil.dimensionsKey][JsonUtil.sizeXkey].AsInt, N[JsonUtil.dimensionsKey][JsonUtil.sizeZkey].AsInt); // Debug.Log("Matrix floor Set prop:"+N.ToString()); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(Fraction.fractionKey)) { foreach (AINumberTower tw in towers) { Fraction f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N); frac = f; tw.SetBaseFraction(f); tw.BuildTower(); } } if (N.GetKeys().Contains(AINumberTower.towerHeightKey)) { foreach (AINumberTower tw in towers) { tw.SetMaxTowerHeight(N[AINumberTower.towerHeightKey].AsInt); } } }
public override void SetProperties(SimpleJSON.JSONClass N) { // Debug.Log("matrifloor setpro:"+N.ToString()); base.SetProperties(N); if (N.GetKeys().Contains(JsonUtil.dimensionsKey)) { ClearFloor(); SetupFloor(N[JsonUtil.dimensionsKey][JsonUtil.sizeXkey].AsInt, N[JsonUtil.dimensionsKey][JsonUtil.sizeZkey].AsInt); SetFloorPlantedStates(N[plantedArrayKey].AsArray); // Debug.Log("Matrix floor Set prop:"+N.ToString()); } }
void SetJsonVersion(SimpleJSON.JSONClass N) { if (N.GetKeys().Contains(GameManager.versionKey)) { thisLevelVersion = N[GameManager.versionKey].AsFloat; WebGLComm.inst.Debug("This json had <color=#0f0> version </color>:" + thisLevelVersion); } else { thisLevelVersion = 1.0f; WebGLComm.inst.Debug("This json did not have a <color=#0f0> version </color> so we assume it's 1.0:" + thisLevelVersion); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); // For setting properties via FractinValueUIComm in level builder // we use the generic fraction key. // Debug.Log("setprop endoor:"+N.ToString()); // if (N.GetKeys().Contains(activatedKey)){ // // activated = N[activatedKey].AsBool; // } if (N.GetKeys().Contains(Fraction.fractionKey)) { SetMaxCharge(JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N)); } // For setting current charge we use the specific key (this can't be set during level builder editing mode) if (N.GetKeys().Contains(LevelMachineBattery.currentChargeKey)) { // Note this setcurrentcharge will pass a levelwasjustloaded=true to LevelMachineBattery to distinguish whether the user completed this action // or it was completed beacuse the level was just loaded SetCurrentCharge(JsonUtil.ConvertJsonToFraction(LevelMachineBattery.currentChargeKey, N)); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(sendTagsKey)) { tagsToSend.AddRange(N[sendTagsKey].Value.Split(',')); // Debug.Log("tag affector set prop tags:"+N[sendTagsKey].Value); } else { // Debug.Log("ruh roh"); } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(Fraction.fractionKey)) { Fraction f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N); SetHoopFraction(f); } /* * Format of properties for the NumberModifiers may differ, look in NumberHoop for the actual implementation of this method. * */ // // commented Debug.Log("props:"+props); }
public static Fraction ConvertJsonToFraction(string fracKey, SimpleJSON.JSONClass N) // Are we getting the full JSON or just the Properties part? hm.. { if (N != null && N.GetKeys().Contains(fracKey)) { // // commented Debug.Log("totally frackey:"+fracKey+", whereas numerator for this frackey;"+N[fracKey][numeratorKey].AsInt.ToString()); return(new Fraction(N[fracKey][Fraction.numeratorKey].AsInt, N[fracKey][Fraction.denominatorKey].AsInt)); } else { // // commented Debug.Log("no frac key on:"+N.ToString()); // if (fracKey == fractionSeqAKey || fracKey == fractionSeqBKey) return new Fraction(0,1); return(new Fraction(1, 1)); // return null; } }
public void OnMenuOpened() { // // commented Debug.Log("setter opened"); SimpleJSON.JSONClass N = LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().GetProperties(); if (N.GetKeys().Contains(PlaceableNPC.speechKey)) { // // commented Debug.Log("got n and st:"+N.ToString()); string s = Utils.FakeToRealQuotes(N[PlaceableNPC.speechKey].Value); // hm.. Some keys appear to be in Json LevelLoader also. speech.text = s; } else { } }
public override void SetProperties(SimpleJSON.JSONClass N) { base.SetProperties(N); if (N.GetKeys().Contains(checkpointKey)) { if (N[checkpointKey].Value == "Current") { SetCheckpointStatus(CheckpointStatus.Current, "setprop"); } else if (N[checkpointKey].Value == "Used") { SetCheckpointStatus(CheckpointStatus.Used, "setprop"); } } }
public void OnMenuOpened() { // // commented Debug.Log("setter opened"); if (LevelBuilder.inst.currentPiece == null) { return; } // string props = LevelBuilder.inst.currentPiece.GetComponent<UserEditableObject>().GetProperties(); SimpleJSON.JSONClass N = LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().GetProperties(); if (N.GetKeys().Contains(UEO_ScaleManipulator.key)) { wallSizeX.text = N[UEO_ScaleManipulator.key][UEO_ScaleManipulator.keyX].Value; // hm.. Some keys appear to be in JsonLevelLoader also. wallSizeY.text = N[UEO_ScaleManipulator.key][UEO_ScaleManipulator.keyY].Value; wallSizeZ.text = N[UEO_ScaleManipulator.key][UEO_ScaleManipulator.keyZ].Value; } // // commented Debug.Log("text set"); }
public override void SetProperties(SimpleJSON.JSONClass N) { // // commented Debug.Log("setprop:"+N.ToString()); base.SetProperties(N); if (N.GetKeys().Contains(Fraction.fractionKey)) { foreach (NumberInfo ni in spikeyChildren) { Fraction f = JsonUtil.ConvertJsonToFraction(Fraction.fractionKey, N); frac = f; ni.SetNumber(f); MonsterAIRevertNumber mairn = ni.GetComponent <MonsterAIRevertNumber>(); if (mairn) { mairn.SetNumber(f); } // // commented Debug.Log("set spikey num;"+ni.fraction); } } }
public void OnMenuOpened() { // // commented Debug.Log("setter opened"); SimpleJSON.JSONClass N = LevelBuilder.inst.currentPiece.GetComponent <UserEditableObject>().GetProperties(); if (N.GetKeys().Contains(PlayerNowMessageTrigger.textTriggerKey)) { // // commented Debug.Log("got n and st:"+N.ToString()); string s = N[PlayerNowMessageTrigger.textTriggerKey].Value; // hm.. Some keys appear to be in JsonLevelLoader also. // s = Regex.Unescape(s); s = Utils.FakeToRealQuotes(s); speech.text = s; } else { // string keylist=""; // N.GetKeys // foreach(string s in N.GetKeys()){ // // commented Debug.Log("key:L"+s); //// // commented Debug.Log("kvkp:"+kvp.Key+","+kvp.Value.ToString()); // } // // commented Debug.Log("missed key:"+PlaceableNPC.speechKey+" in :"+N.ToString()); } }