public string CreateIsland(Player creator, string islandName, int position, IslandType type = IslandType.Default) { Configurations = new Configurations() { Position = position, IslandName = islandName }; string reason = Configurations.CreateConfigFile(creator, islandName, position, type); if (reason != string.Empty) { return(reason); } Owner = creator.Username; Position = Configurations.Position; Zone = Configurations.GetZone(); Name = Configurations.GetIslandName(); RespawnPosition = Configurations.GetRespawnPosition(); Type = type; MembersLimit = 5 + (int)Type * 2; //Block block = new Block(2) { Coordinates = RespawnPosition }; //Level.SetBlock(block); CreateIslandCustomizing(Zone.First, Type); return(string.Empty); }
void Awake() { if (original_island_type == IslandType.Null) { original_island_type = island_type; } }
public void ChangeType(IslandType new_type, bool force) { if (!force && (blocked || my_toy != null)) { Debug.Log("Attempting to change an island (" + transform.parent.gameObject.name + ") that is not empty!\n"); return; } if (My_sprite == null) { Debug.Log("Islandbutton " + transform.parent.gameObject.name + " could not find a sprite renderer!\n"); return; } else { Sprite new_sprite = null; //if (new_type == IslandType.Permanent) new_sprite = Get.getPreviewSprite("Levels/red_island"); //else new_sprite = Get.getPreviewSprite("Levels/blue_island"); try { new_sprite = Get.getIslandSprite(Peripheral.Instance.env_type, new_type); } catch (Exception e) { Debug.Log("level " + Central.Instance.current_lvl + " " + this.gameObject + " failed to get sprite for " + Peripheral.Instance.env_type + " type " + new_type + "\n"); } My_sprite.sprite = new_sprite; } island_type = new_type; }
void DoModulatorStuff() { my_toy.Die(0f); IslandType new_type = (my_toy.island.island_type == IslandType.Permanent) ? IslandType.Temporary : IslandType.Permanent; my_toy.island.ChangeType(new_type, false); }
public IslandCustomizing(IslandType Type) { if (!File.Exists("IslandsTypes/" + Type + ".build")) { return; } string blocksString = Files.OpenRead("IslandsTypes/" + Type + ".build"); string[] blocks = blocksString.Split('|'); foreach (string StrBlock in blocks) { string[] BlockConf = StrBlock.Split(','); Block block = new Block(Convert.ToByte(BlockConf[0])); BlockCoordinates Coordinates = new BlockCoordinates(); if (BlockConf.Length == 5) { block.Metadata = Convert.ToByte(BlockConf[1]); Coordinates = new BlockCoordinates(Convert.ToInt32(BlockConf[2]), Convert.ToInt32(BlockConf[3]), Convert.ToInt32(BlockConf[4])); } else { Coordinates = new BlockCoordinates(Convert.ToInt32(BlockConf[1]), Convert.ToInt32(BlockConf[2]), Convert.ToInt32(BlockConf[3])); } block.Coordinates = Coordinates; Blocks.Add(block); } }
// Constructor for new Waypoint Generation public Waypoint(Point p, MarkerType marker, IslandType island) { this.Location = Coordinates.FromPoint(p); this.Island = island; this.Marker = marker; this.Name = string.Empty; this.Notes = String.Empty; }
// Constructor for new Waypoint Generation public Waypoint(Coordinates c, MarkerType marker, IslandType island) { this.Location = c; this.Island = island; this.Marker = marker; this.Name = string.Empty; this.Notes = String.Empty; }
static public void SetCamouflageType(int value) { switch (value) { case 0: { ShipController.camouflageType = IslandType.Banyan; banyanIcon.SetActive(true); cinchonaIcon.SetActive(false); coconutIcon.SetActive(false); rubberIcon.SetActive(false); break; } case 1: { ShipController.camouflageType = IslandType.Cinchona; banyanIcon.SetActive(false); cinchonaIcon.SetActive(true); coconutIcon.SetActive(false); rubberIcon.SetActive(false); break; } //Ask about enemy case 2: { ShipController.camouflageType = IslandType.Coconut; banyanIcon.SetActive(false); cinchonaIcon.SetActive(false); coconutIcon.SetActive(true); rubberIcon.SetActive(false); break; } case 3: { ShipController.camouflageType = IslandType.Rubber; banyanIcon.SetActive(false); cinchonaIcon.SetActive(false); coconutIcon.SetActive(false); rubberIcon.SetActive(true); break; } } foreach (Transform child in LevelManager.Instance.ChessBoard.transform) { if (child.gameObject.CompareTag("Island")) { bool isSameCamouflage = CompareCamouflage(child.gameObject); foreach (Transform grandchild in child) { if (grandchild.gameObject.CompareTag("ShallowSea")) { grandchild.GetComponent <BoxCollider2D>().enabled = !isSameCamouflage; grandchild.Find("Activated").gameObject.SetActive(isSameCamouflage); grandchild.Find("Deactivated").gameObject.SetActive(!isSameCamouflage); } } } } }
public Waypoint AddWaypoint(IslandType i, MarkerType m, Point p) { if (i == IslandType.None && m == MarkerType.None || waypoints.Exists(x => x.GetLocation() == p)) return null; Waypoint wp = new Waypoint(p, m, i); waypoints.Add(wp); return wp; }
public IslandType GetIslandType() { if (Config == string.Empty) { return(IslandType.None); } IslandType islandType = Config.Split('|')[3].ToIslandType(); return(islandType); }
public Island(Texture2D sprite, Colour colour, IslandType type, Resource resource, Token token) : base(sprite) { Colour = colour; Scale = new Vector2(0.3f); ResourceType = resource; Type = type; Tokens = new Token[4]; AddToken(token); // add the token for this colour of island }
public void ShowIslandSprites(bool show, IslandType type) { foreach (Island_Button island in islands.Values) { if (island.island_type == type) { island.My_sprite.gameObject.SetActive(show); island.Hidden = !show; } } }
public string TakeConfig(string islandName, int position, IslandType type) { IslandName = islandName; Position = position; islandType = type; IslandZone zone = GetZone(); PositionEdge respawn = zone.First + new PositionEdge(50, 50); RespawnPosition = respawn.ToBlockCoordinates(74); return(TakeConfig()); }
public void CreateIslandCustomizing(PositionEdge First, IslandType Type) { IslandCustomizing Customizing = new IslandCustomizing(Type); Block[] blocks = Customizing.Blocks.ToArray(); foreach (Block block in blocks) { block.Coordinates += First.ToBlockCoordinates(); Level.SetBlock(block, true, false); } PlaceChest(First); }
public Waypoint AddWaypoint(IslandType i, MarkerType m, Point p) { if (i == IslandType.None && m == MarkerType.None || waypoints.Exists(x => x.GetLocation() == p)) { return(null); } Waypoint wp = new Waypoint(p, m, i); waypoints.Add(wp); return(wp); }
public Island(IslandType type, AnvilWorld world) { IslandType = type; var block = world.Dimensions[(int)type.GetDimension()].Blocks.GetBlock(type.GetCoordinate().X, type.GetCoordinate().Y, type.GetCoordinate().Z); var id = block.Block.Id; var metadata = block.Metadata; // ブロックIDが121(エンドポータルフレームは120のはずだけどなぜか121) // 且つメタデータが4以上7以下(向きが4方向あるため) IsComplete = id == 121 && (4 <= metadata && metadata <= 7); }
public Island(Texture2D sprite, Colour colour, IslandType type, Resource resource, Texture2D[] tokens) : base(sprite) { Colour = colour; scale = new Vector2(0.3f); ResourceType = resource; Type = type; redToken = new Token(tokens[0]); blueToken = new Token(tokens[1]); yellowToken = new Token(tokens[2]); greenToken = new Token(tokens[3]); AddResource(resource); }
// creates a new boat matching the specified colour, loading the sprite from the contentmanager public static Island InitializeFromColour(Colour colour, ContentManager content) { // retrieve texture name from list that matches specified colour // choosing randomly using random number generator to choose fron the islands available var rng = new Random(); string textureName = ""; Dictionary <IslandType, string> islands = null; switch (colour) { case Colour.Blue: islands = blueIslands; break; case Colour.Yellow: islands = yellowIslands; break; case Colour.Red: islands = redIslands; break; case Colour.Green: islands = greenIslands; break; } // retrieve a random islandtype matching the colour and the associated texture IslandType type = islands.Keys.ToList()[rng.Next(islands.Count)]; textureName = islands[type]; // load the texture specified from a folder named Islands Texture2D sprite = content.Load <Texture2D>("Islands/" + textureName); //Debug.WriteLine("Island Content Loaded: " + textureName); // create a resource for the selected islandtype Resource resource = Resource.InitializeFromIslandType(colour, type, content); Texture2D rToken = content.Load <Texture2D>("Tokens/RedToken"); Texture2D bToken = content.Load <Texture2D>("Tokens/BlueToken"); Texture2D yToken = content.Load <Texture2D>("Tokens/YellowToken"); Texture2D gToken = content.Load <Texture2D>("Tokens/GreenToken"); Texture2D[] tokens = { rToken, bToken, yToken, gToken }; // create a new entity using the loaded sprite return(new Island(sprite, colour, type, resource, tokens)); }
private IslandType ActiveIsland() { Type eType = Type.GetType("SaltCharts.IslandType"); IslandType island = IslandType.None; foreach (Control c in grpIsland.Controls) { if (c.GetType() == typeof(RadioButton) && ((RadioButton)c).Checked) { island = (IslandType)Enum.Parse(eType, (String)c.Tag, true); break; } } return(island); }
public static Sprite getIslandSprite(EnvType env, IslandType island_type) { switch (env) { case EnvType.Desert: return((island_type == IslandType.Temporary) ? getSprite("Levels/Islands/desert_temporary_island") : getSprite("Levels/Islands/desert_permanent_island")); case EnvType.Forest: return((island_type == IslandType.Temporary) ? getSprite("Levels/Islands/forest_temporary_island") : getSprite("Levels/Islands/forest_permanent_island")); case EnvType.DarkForest: return((island_type == IslandType.Temporary) ? getSprite("Levels/Islands/dark_forest_temporary_island") : getSprite("Levels/Islands/dark_forest_permanent_island")); default: return((island_type == IslandType.Temporary) ? getSprite("Levels/Islands/forest_temporary_island") : getSprite("Levels/Islands/forest_permanent_island")); } }
#pragma warning restore 0649 /// <summary> /// Loads an island scene based on GameMaster settings. /// </summary> public void LoadIslands() { if (hasLoadedIslands) { return; } var islandSize = GameMaster.Instance.SelectedIslandSize; CurrentIslandType = (IslandType)Random.Range(0, Enum.GetNames(typeof(IslandType)).Length); GameMaster.Instance.CurrentIslandType = CurrentIslandType; var sceneId = Mathf.Clamp(smallIslandIndex + (int)islandSize, smallIslandIndex, largeIslandIndex); SceneManager.SetActiveScene(SceneManager.GetSceneByBuildIndex(smallIslandIndex - 1)); SceneManager.LoadSceneAsync(sceneId, LoadSceneMode.Additive); hasLoadedIslands = true; }
private void Waypoint_MouseUp(object sender, MouseEventArgs e) { PictureBox pb = (PictureBox)sender; Waypoint wp = map.GetWaypoint(pb.Location); this.Cursor = Cursors.Arrow; if (e.Button == MouseButtons.Left && mapBoxLoc.Equals(pb.Parent.Location)) { var frm = new WaypointDetails(wp); frm.StartPosition = FormStartPosition.Manual; frm.Location = new Point(Cursor.Position.X, Cursor.Position.Y); frm.ShowDialog(this); } else if (e.Button == MouseButtons.Right) { if (btnNoIsland.Checked && btnNoMarker.Checked) { DeleteWaypoint(pb); } else if (btnStamp.Checked) { AddStamp(new Point(pb.Location.X + e.Location.X, pb.Location.Y + e.Location.Y)); } else if (btnTwoByTwo.Checked) { return; } else { IslandType island = ActiveIsland(); MarkerType marker = ActiveMarker(); if (wp.Island != island || wp.Marker != marker) { wp.Island = island; wp.Marker = marker; pb.Image = wp.GetImage(); } } } }
private void AddWaypoint(Point location) { IslandType island = ActiveIsland(); MarkerType marker = ActiveMarker(); if (island == IslandType.None && marker == MarkerType.None) { return; } AddToMap(map.AddWaypoint(island, marker, location)); if (btnTwoByTwo.Checked) { AddToMap(map.AddWaypoint(IslandType.NorthEast, marker, new Point(location.X + 40, location.Y))); AddToMap(map.AddWaypoint(IslandType.SouthWest, marker, new Point(location.X, location.Y + 40))); AddToMap(map.AddWaypoint(IslandType.SouthEast, marker, new Point(location.X + 40, location.Y + 40))); } AutoSave(); }
public static IslandType GetIslandTypeByPermission(this Player player) { IslandType islandType = IslandType.Default; switch (player.Permission) { case "VIP": islandType = IslandType.VipIsland; break; case "MOD": islandType = IslandType.VipIsland; break; case "GMOD": islandType = IslandType.VipIsland; break; case "PREMIUM": islandType = IslandType.PremiumIsland; break; case "ADMIN": islandType = IslandType.PremiumIsland; break; case "DELUXE": islandType = IslandType.DeluxeIsland; break; case "OWNER": islandType = IslandType.DeluxeIsland; break; } return(islandType); }
/* * public void StopTween(GameObject obj){ * Tweener[] stopme = obj.GetComponentsInChildren<Tweener> (); * for (int i = 0; i < stopme.Length; i++) * { * stopme[i].StopMe(); * } * } */ public void Do() { // Debug.Log("Doing gameaction " + this._type + " " + this.name + " " + _text + "\n"); switch (_type) { case ActionType.UIFilter: if (_name.Equals("")) { EagleEyes.Instance.ResetUIFilter(); } else { EagleEyes.Instance.SetUIFilter(_name, _text); } break; case ActionType.SetSensibleWishUplift: Peripheral.Instance.getLevelMod().sensible_wish_uplift = _number; break; case ActionType.Panel: if (Peripheral.Instance == null) { Debug.Log("NO PERIPHERAL\n"); return; } if (Peripheral.Instance.zoo == null) { Debug.Log("NO ZOO\n"); return; } GameObject panel = Peripheral.Instance.zoo.getObject(_name, true); if (panel == null) { Debug.LogError("GameAction could not find object " + _name + "\n"); } if (!_bool) { panel.transform.SetParent(EagleEyes.Instance.events.transform); } else { panel.transform.SetParent(EagleEyes.Instance.world_space_events.transform); } panel.gameObject.transform.GetChild(0).gameObject.SetActive(true); panel.transform.localPosition = Vector3.zero; panel.transform.localScale = Vector3.one; panel.transform.localRotation = Quaternion.identity; break; case ActionType.ShowIslands: Debug.Log("Show islands " + _name + " " + _bool); IslandType type = EnumUtil.EnumFromString <IslandType>(_name, IslandType.Null); if (type == IslandType.Null) { Debug.LogError("Event trying to show (" + _bool + ")islands of invalid type: " + _name + "\n"); return; } Monitor.Instance.ShowIslandSprites(_bool, type); break; case ActionType.EnemyDescription: GameObject enemy_desc = Peripheral.Instance.zoo.getObject("Tutorial/Descriptions/generic_enemy_description", true); if (enemy_desc == null) { Debug.LogError("GameAction could not find object " + _name + "\n"); } enemy_desc.transform.SetParent(EagleEyes.Instance.events.transform); enemy_desc.gameObject.transform.GetChild(0).gameObject.SetActive(true); enemy_desc.transform.localPosition = Vector3.zero; enemy_desc.transform.localScale = Vector3.one; enemy_desc.transform.localRotation = Quaternion.identity; enemy_desc.GetComponent <EnemyDescriptionLabel>().setType(_text); RectTransform b = enemy_desc.GetComponent <EnemyDescriptionButton>().button; Vector3 pos = b.localPosition; pos.y += _number * -6.5f; //Debug.Log(_number + "\n"); b.localPosition = pos; break; case ActionType.MakeFloaty: //GameObject floaty = Peripheral.Instance.zoo.getObject(_name, true); //if (floaty == null) { Debug.Log("GameAction could not find object " + _name + "\n"); } // floaty.GetComponent<Floaty>().Init(_vector); break; case ActionType.AddWish: WishType w = Get.WishTypeFromString(_text); // Debug.Log("We should add a wish " + _text + " " + w + "\n"); Peripheral.Instance.my_inventory.AddWish(w, _number, 1); break; case ActionType.AddDream: if (_number <= 0) { return; } Peripheral.Instance.addDreams(_number, Vector3.zero, false); break; case ActionType.GiveSpecialSkill: EffectType effect_type = EnumUtil.EnumFromString <EffectType>(_name, EffectType.Null); RuneType rune_type = EnumUtil.EnumFromString <RuneType>(_text, RuneType.Null); Rune r = Central.Instance.getHeroRune(rune_type); if (r == null) { Debug.LogError("Cannot find a rune for hero of type " + rune_type + ", cannot give skill " + effect_type + "\n"); } r.GiveSpecialSkill(effect_type); break; case ActionType.MakeWish: List <Wish> inv = new List <Wish>(); inv.Add(new Wish(WishType.Sensible, 0.2f * _number)); inv.Add(new Wish(WishType.MoreDamage, 0.1f * _number)); inv.Add(new Wish(WishType.MoreXP, 015f * _number)); inv.Add(new Wish(WishType.MoreDreams, 0.1f * _number)); inv.Add(new Wish(WishType.MoreHealth, 0.1f * _number)); if (onMakeWish != null) { onMakeWish(inv, _vector); } Debug.Log("We should make a wish\n"); break; case ActionType.Pause: Peripheral.Instance.Pause(true); break; case ActionType.Resume: // Debug.Log("Resuming\n"); Peripheral.Instance.Pause(false); break; case ActionType.DisableMonitor: Monitor.Instance.is_active = _bool; break; case ActionType.HideUIElement: //name is include, //text is exclude // Debug.Log("Setting " + _name + " to " + _bool + "\n"); EagleEyes.Instance.PlaceElement(_name, _bool); break; case ActionType.DisableUIElement: //name is include, //text is exclude //BUTTON HAS TO BE in GUI STATES WITH A MYLABEL EagleEyes.Instance.DisableElement(_name, _bool); //EagleEyes.Instance.SetEnableButtons(_name, _text, _bool); break; case ActionType.RemoveEventObjects: RemoveEventObjects(); break; case ActionType.UnlockToy: Debug.Log("Unlocking toy " + _text + "\n"); //Peripheral.Instance.ActivateToy(_text); unitStats toy = Central.Instance.getToy(_text); toy.isUnlocked = true; EagleEyes.Instance.UpdateToyButtons("blah", ToyType.Null, false); break; case ActionType.PointSpyGlass: if (Monitor.Instance != null) { Monitor.Instance.my_spyglass.PointSpyglass(_vector, true); } break; case ActionType.EnableSpyGlass: if (Monitor.Instance != null) { Monitor.Instance.my_spyglass.DisableByEvent(!_bool); } break; case ActionType.RemoveObject: if (_target != null) { foreach (GameObject t in _target) { Peripheral.Instance.zoo.returnObject(t); } } if (_name != null) { Debug.Log("GameAction removing object with name, TERRIBLE\n"); } Peripheral.Instance.zoo.returnObject(GameObject.Find(_name)); break; case ActionType.EnableReward: RewardType rt = EnumUtil.EnumFromString <RewardType>(_text, RewardType.Null); if (rt != RewardType.Null) { RewardOverseer.RewardInstance.EnableReward(rt); } else { Debug.LogError(this.gameObject.name + " RewardType gameAction has an invalid rewardType( " + _text + ")\n"); } break; default: Debug.LogError(this.gameObject.name + " " + _type + " gameAction has an unsupported ActionType\n"); break; } }
public bool HasStamp(IslandType islandType) { return(Assets[AssetType.PassportStamp].Cast <PassportStamp>().Any(i => i.IslandType == islandType)); }
public string CreateConfigFile(Player creator, string islandName, int position, IslandType type) { if (TakeConfig(islandName, position, type) == string.Empty) { return("empty config"); } Configurations config = new Configurations(creator); if (config.Reason != string.Empty) { if (config.Reason == "Owner") { return(SkyBlock.LangManager.getLang("eng").getString("skyblock.island.have")); } if (config.Reason == "Member") { return(SkyBlock.LangManager.getLang("eng").getString("skyblock.island.liveonanother")); } return("reason error : " + config.Reason); } Owner = creator.Username; Files.Create("SkyBlock/" + Owner + "/IsConfigurations.player", Config); return(string.Empty); }
public SelectedToy(string n, IslandType type) { name = n; island_type = type; }
public PassportStamp(IslandType islandType) : base(AssetType.PassportStamp, 100000, String.Format("{0} passport stamp", islandType)) { IslandType = islandType; }
public Travel(IslandType islandType, TransportType transportType) { IslandType = islandType; TransportType = transportType; }