void Start()
 {
     Instance             = this;
     meshRenderer         = this.gameObject.GetComponentInChildren <MeshRenderer>();
     meshRenderer.enabled = true;
     oldScale             = this.transform.parent.localScale;
 }
Esempio n. 2
0
    /// <summary>
    /// On removal on an object from the stack.
    /// </summary>
    /// <returns></returns>
    ///
    internal void stack_remove(MapContainer drawObject)
    {
        if (positonStack.Contains(drawObject))
        {
            var index = positonStack.IndexOf(drawObject);

            for (int i = index + 1; i < positonStack.Count; i++)
            {
                if (positonStack.Count < 10 && seperationMethod == Sepration.HorizontalSeperation)
                {
                    positonStack[i].animationStarted = true;
                    positonStack[i].startPos         = positonStack[i].transform.localPosition;
                    positonStack[i].anim.Play("ZMovement");
                    //gameObject.transform.localScale -= new Vector3(0, 0, 0.05F);
                }
                else
                {
                    if (seperationMethod == Sepration.VerticalSeperation)
                    {
                        positonStack[i].transform.position -= new Vector3(0, seperationDistance, 0);
                    }
                    else
                    {
                        var translation = this.transform.TransformDirection(new Vector3(0, seperationDistance, 0));

                        positonStack[i].transform.position -= translation;
                    }
                }
            }

            positonStack.Remove(drawObject);
        }
    }
Esempio n. 3
0
        private static void ExportImages(MapContainer mapContainer)
        {
            mapContainer.GetType(MapItemTypes.Image, out var imagesStart, out var imagesNum);
            Debug.Log("map", imagesNum > 0 ? "images:" : "images not found");

            for (var i = 0; i < imagesNum; i++)
            {
                var image     = mapContainer.GetItem <MapItemImage>(imagesStart + i, out _, out _);
                var imageName = mapContainer.GetData <string>(image.ImageName);

                Debug.Log("map", "   " + string.Join(';', new string[]
                {
                    $"name={imageName}",
                    $"width={image.Width}",
                    $"height={image.Height}",
                    $"external={image.External}"
                }));

                //var imageData = mapContainer.GetData<byte[]>(image.ImageData);
                //var format = Image.DetectFormat(imageData);

                //using (var image32 = Image.Load<Rgba32>(imageData))
                //{
                //    image32.Save($"{image.ImageName}.png");
                //}

                mapContainer.UnloadData(image.ImageName);
            }
        }
Esempio n. 4
0
    private bool SaveNodes(MapContainer MapContainer)
    {
        //if has edge
        if (Edges.Any())
        {
            //find linked output port (edges inputside != null dedicates that the output port has a link)
            //note: edges input,output dedicate different nodes' port and there relation;
            //   ________               ________
            //   | Node1 |   edge(x)   | Node2 |
            //  in      out-----------in      out
            //   |_______|             |_______|
            var connectedEdges = Edges.Where(x => x.input.node != null).ToArray();

            //only save output port link message
            for (int i = 0; i < connectedEdges.Length; i++)
            {
                var outputNode = connectedEdges[i].output.node as MapNode;
                var inputNode  = connectedEdges[i].input.node as MapNode;

                MapContainer.linkdata.Add(
                    new NodeLinkedData
                {
                    FromNodeGuid   = outputNode.GUID,
                    outPortName    = connectedEdges[i].output.portName,
                    TargetNodeGuid = inputNode.GUID,
                    inPortName     = connectedEdges[i].input.portName,
                }
                    );
            }
        }



        foreach (var MapNode in Nodes)
        {
            var mapNodeData = new MapNodeData
            {
                NodeGUID = MapNode.GUID,
                MapText  = MapNode.MapText,
                Position = MapNode.GetPosition().position,
                roomType = MapNode.roomType
            };
            foreach (Port inputPort in MapNode.inputContainer.Children().ToList().Cast <Port>().ToList())
            {
                mapNodeData.inputPorts.Add(new PortData {
                    portName = inputPort.portName, direction = Direction.Input
                });
            }

            foreach (Port outputPort in MapNode.outputContainer.Children().ToList().Cast <Port>().ToList())
            {
                mapNodeData.outputPorts.Add(new PortData {
                    portName = outputPort.portName, direction = Direction.Output
                });
            }
            MapContainer.nodedata.Add(mapNodeData);
        }

        return(true);
    }
        private void Event_PreZoom(object sender, MouseWheelEventArgs e)
        {
            if (Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl))
            {
                e.Handled = true;

                var e2 = new MouseWheelEventArgs(e.MouseDevice, e.Timestamp, e.Delta);
                e2.RoutedEvent = ListBox.MouseWheelEvent;
                e2.Source      = e.Source;

                MapContainer.RaiseEvent(e2);
            }
            else
            {
                e.Handled = true;

                if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                {
                    Scroller.ScrollToHorizontalOffset(Scroller.HorizontalOffset - e.Delta);
                }
                else
                {
                    Scroller.ScrollToVerticalOffset(Scroller.VerticalOffset - e.Delta);
                }
                e.Handled = true;
            }
        }
Esempio n. 6
0
 public Authority()
 {
     WeightThreshold = 1;
     AccountAuths    = new MapContainer <AccountIdType, ushort>();
     KeyAuths        = new MapContainer <PublicKeyType, ushort>();
     AddressAuths    = new MapContainer <object, ushort>();
 }
Esempio n. 7
0
    public bool LoadStageData(SaveDataStore saveData)
    {
        m_StageIndex = saveData.m_StageIndex - 1;
        if (m_StageIndex < 0 || m_StageIndex >= m_StageAssets.Length)
        {
            return(false);
        }
        m_Container = ObjectSaveLoad.JsonDataLoad <MapContainer>(m_StageAssets[m_StageIndex].text);
        m_Container.InitTileDataMap();
        m_ShopItemList   = m_Container.shopItemList;
        m_ShopWeaponList = m_Container.shopWeaponList;

        m_StageMapManager.CreateStageMap(m_Container);
        for (int i = 0; i < saveData.m_ChestStates.Count; i++)
        {
            HexCoord hex = new HexCoord(saveData.m_ChestStates[i].m_LocX, saveData.m_ChestStates[i].m_LocY);
            m_StageMapManager.GetMapTile(hex).SetChestState(saveData.GetChestState(hex));
        }

        List <PlayerRecord> userPlayerRecords  = GetUserPlayerRecords(saveData.m_UserPlayerRecords, saveData.m_StagePlayerRecords);
        List <PlayerRecord> enemyPlayerRecords = GetEnemyPlayerRecords(saveData.m_StageEnemyRecords);

        m_PlayerManager.GenetarePlayers(userPlayerRecords);
        m_PlayerManager.GenetarePlayers(enemyPlayerRecords);
        m_ScenarionManager.SetScenarion(m_Container.scenarionList, saveData.m_RemoveScenaroList);
        return(true);
    }
Esempio n. 8
0
        static void Main(string[] args)
        {
            using (var stream = File.OpenRead($"{MAP_NAME}.map"))
            {
                if (stream == null)
                {
                    Debug.Error("map", $"could not open map='{MAP_NAME}'");
                }
                else
                {
                    var mapContainer = MapContainer.Load(stream, out var error);
                    if (mapContainer == null)
                    {
                        Debug.Error("map", $"error with load map='{MAP_NAME}' ({error})");
                    }
                    else
                    {
                        Debug.Log("map", $"successful load map='{MAP_NAME}' ({error})");
                        ShowMapInfo(mapContainer);
                        ExportImages(mapContainer);
                    }
                }
            }

            Console.ReadLine();
        }
Esempio n. 9
0
        private void UnEquipItem(MessageTemplate template, NetIncomingMessage message)
        {
            int index = -1;

            try
            {
                int.TryParse(template.JsonMessage, out index);
            }
            catch
            { }

            if (index != -1)
            {
                CharacterPlayer character = MapContainer.FindCharacterByID(message.SenderConnection.RemoteUniqueIdentifier);
                WeaponItem      newItem   = character.GetInventory().ElementAt(index);
                if (newItem != null)
                {
                    int        type        = (int)newItem.GetEqupmentType();
                    WeaponItem currentItem = character.Equipment[type];

                    if (currentItem == null)
                    {
                        character.Inventory[index] = null;
                    }
                    else
                    {
                        character.Inventory[index] = currentItem;
                    }

                    character.Equipment[type] = newItem;
                }
            }
        }
Esempio n. 10
0
    /// <summary>
    /// Draws a flow between given origin and the siblings, which are currently selected.
    /// </summary>
    /// <param name="origin_map">Origin of the flows</param>
    /// <returns></returns>
    ///
    public virtual void GetInternalFlows(MapContainer origin_map)
    {
        Dictionary <String, InteractableMap> lchild = new Dictionary <string, InteractableMap>();

        foreach (var ma2p in origin_map.GetComponentsInChildren <InteractableMap>())
        {
            lchild[ma2p.name] = ma2p;
        }

        foreach (var pair in this.getMapController().flattenedList[origin_map.parentName].Take(100))
        {
            try
            {
                var origin      = lchild[pair.Item1];
                var destination = lchild[pair.Item2];
                var flowData    = pair.Item3;

                Bezier b = new Bezier(origin_map.transform, origin, destination, 0.1F * (0.00000699192F * flowData + 0.05F));
                origin_map.internalLines.Add(b);
            }
            catch { }

            //b.line.startWidth = 0.1F * (0.00000699192F * flowData + 0.05F);
            //Debug.Log("line width = " + b.line.startWidth.ToString());
            //b.line.endWidth = b.line.startWidth;

            //b.line.material = new Material(Shader.Find("Sprites/Default"));

            //b.line.startColor = Color.green; //new Color(253, 187, 45, 255);
            //b.line.endColor = Color.blue; // new Color(34, 193,195, 255);
        }
    }
Esempio n. 11
0
    /// <summary>
    /// Behaviour, when the trigger button is pressed.
    /// If the map is currently selected, consider this a delete
    /// If the map is not selected, draw a new map
    /// <returns></returns>
    ///
    public override GameObject OnTriggerPressed(Transform direction)
    {
        if (!this.IsSelected())
        {
            //Create the gameObject for the map and then Draw it.
            GameObject mapGameObject = new GameObject();
            mapGameObject.transform.parent = this.transform.root;
            MapContainer main = mapGameObject.AddComponent(typeof(MapContainer)) as MapContainer;
            main?.Draw(this, this.GetLevel() + 1, this.transform.parent.transform, direction);


            this.selected = true;
            CreateLine();
            this.GetInternalFlows(main);
            return(main.gameObject);
        }
        else
        {
            //On Deselect Remove it from the current list and Delete the object and its children
            this.selected = false;
            DestoryLine();


            this.DeleteChildren();
            return(null);
        }
    }
        public SmbConnection()
        {
            isClientSupportExtSecurity = false;
            sutSignState    = SignState.Disabled;
            sutCapabilities = new Set <Capabilities>();
            isNegotiateSent = false;
            sessionList     = new MapContainer <int, SmbSession>();
            treeConnectList = new MapContainer <int, SmbTree>();

            SutNextReceiveSequenceNumber = 1;
            SutSendSequenceNumber        = new SetContainer <int>();
            clientCapabilities           = new Set <Capabilities>();

            openedFiles            = new MapContainer <int, SmbFile>();
            openedPipes            = new MapContainer <int, SmbPipe>();
            openedMailslots        = new MapContainer <int, SmbMailslot>();
            sentRequest            = new MapContainer <int, SmbRequest>();
            sessionId              = 0;
            treeId                 = 0;
            fId                    = 0;
            searchHandlerContainer = new MapContainer <int, int>();
            clientSignState        = SignState.Disabled;
            isSigningActive        = false;
            accountType            = AccountType.Admin;
        }
Esempio n. 13
0
        protected override bool LoadMap(string mapName)
        {
            mapName = Path.GetFileNameWithoutExtension(mapName);
            var path = $"maps/{mapName}.map";

            Console.Print(OutputLevel.Debug, "map", $"loading map='{path}'");

            using (var stream = Storage.OpenFile(path, FileAccess.Read))
            {
                if (stream == null)
                {
                    Console.Print(OutputLevel.Debug, "map", $"could not open map='{path}'");
                    return(false);
                }

                CurrentMap = MapContainer.Load(stream, out var error);
                if (CurrentMap == null)
                {
                    Console.Print(OutputLevel.Debug, "map", $"error with load map='{path}' ({error})");
                    return(false);
                }
                CurrentMap.MapName = mapName;
                Console.Print(OutputLevel.Debug, "map", $"successful load map='{path}' ({error})");

                return(true);
            }
        }
Esempio n. 14
0
        public static void DisconnectConnection(NetConnection sender, Scene scene)
        {
            NetServer server = ServerNetworkSceneComponent.GetNetServer();

            LoginManagerServer login = MapContainer.GetLoginByID(sender.RemoteUniqueIdentifier);

            if (login != null)
            {
                CharacterPlayer characterPlayer = login.GetCharacter();

                //Saves data to SQL database
                string characterString = Newtonsoft.Json.JsonConvert.SerializeObject(characterPlayer, new StringEnumConverter());
                SQLManager.UpdateToSQL(login.username, characterString);

                //removes login manager
                MapContainer.RemoveLoginByID(login.GetUniqueID());

                if (characterPlayer != null)
                {
                    //removes entity
                    CharacterManager.RemoveCharacterFromScene(scene, characterPlayer._name);
                }
            }

            //removes the connection
            sender.Disconnect("Closed");
            Console.WriteLine("Disconnected! Connected: " + ServerNetworkSceneComponent.GetNetServer().ConnectionsCount);
            MainScene.ConnectedCount.SetText("Current connections: " + server.ConnectionsCount);
        }
Esempio n. 15
0
 public MapContainer GenerateMap(int width, int height, TerrainId defaultFill)
 {
     _map = new MapContainer();
     _map.Generate(width, height);
     FillTerrain(defaultFill);
     return(_map);
 }
Esempio n. 16
0
 public Tile(int x, int y, Terrain terrain, MapContainer map)
 {
     LocationX = x;
     LocationY = y;
     Map       = map;
     SetTerrain(terrain);
     ClanOwnershipId = -1;
 }
Esempio n. 17
0
	public string SaveToText(MapContainer mapInfo) {

		var serializer = new XmlSerializer(typeof(MapContainer));

		StringWriter textWriter = new StringWriter();
		serializer.Serialize(textWriter, mapInfo);

		return textWriter.ToString();
	}
Esempio n. 18
0
    public static void Save(MapContainer mapContainer, string filename)
    {
        var serializer = new XmlSerializer(typeof(MapContainer));

        using (var stream = new FileStream(filename, FileMode.Create))
        {
            serializer.Serialize(stream, mapContainer);
        }
    }
 void InitializeBuiltinAttributes()
 {
     if (builtinAttributeSyntax != null)
     {
         return;
     }
     builtinAttributeSyntax = new MapContainer<string, AttributeContext>();
     builtinAttributeSyntax[StandardNames.attributeID.ToLower()] =
         new AttributeContext(this, StandardNames.attributeID, Syntax.Lookup("2.5.5.2", 6, null));
     builtinAttributeSyntax[StandardNames.attributeSyntax.ToLower()] =
         new AttributeContext(this, StandardNames.attributeSyntax, Syntax.Lookup("2.5.5.2", 6, null));
     builtinAttributeSyntax[StandardNames.governsId.ToLower()] =
         new AttributeContext(this, StandardNames.governsId, Syntax.Lookup("2.5.5.2", 6, null));
     builtinAttributeSyntax[StandardNames.isSingleValued.ToLower()] =
         new AttributeContext(this, StandardNames.isSingleValued, Syntax.Boolean);
     builtinAttributeSyntax[StandardNames.ldapDisplayName.ToLower()] =
         new AttributeContext(this, StandardNames.ldapDisplayName, Syntax.Lookup("2.5.5.12", 64, null));
     builtinAttributeSyntax[StandardNames.objectClass.ToLower()] =
         new AttributeContext(this, StandardNames.objectClass, Syntax.Lookup("2.5.5.2", 6, null), false, null);
     builtinAttributeSyntax[StandardNames.oMObjectClass.ToLower()] =
         new AttributeContext(this, StandardNames.oMObjectClass, Syntax.Lookup("2.5.5.10", 4, null));
     builtinAttributeSyntax[StandardNames.oMSyntax.ToLower()] =
         new AttributeContext(this, StandardNames.oMSyntax, Syntax.Lookup("2.5.5.9", 2, null));
     builtinAttributeSyntax[StandardNames.rDNAttID.ToLower()] =
         new AttributeContext(this, StandardNames.rDNAttID, Syntax.Lookup("2.5.5.2", 6, null));
     builtinAttributeSyntax[StandardNames.subClassOf.ToLower()] =
         new AttributeContext(this, StandardNames.subClassOf, Syntax.Lookup("2.5.5.2", 6, null), false, null);
     builtinAttributeSyntax[StandardNames.cn.ToLower()] =
         new AttributeContext(this, StandardNames.cn, Syntax.Lookup("2.5.5.12", 64, null));
     builtinAttributeSyntax[StandardNames.schemaIDGUID.ToLower()] =
         new AttributeContext(this, StandardNames.schemaIDGUID, Syntax.Lookup("2.5.5.10", 4, null));
     builtinAttributeSyntax[StandardNames.systemOnly.ToLower()] =
         new AttributeContext(this, StandardNames.systemOnly, Syntax.Boolean);
     builtinAttributeSyntax[StandardNames.rangeLower.ToLower()] =
         new AttributeContext(this, StandardNames.rangeLower, Syntax.Lookup("2.5.5.9", 2, null));
     builtinAttributeSyntax[StandardNames.rangeUpper.ToLower()] =
         new AttributeContext(this, StandardNames.rangeUpper, Syntax.Lookup("2.5.5.9", 2, null));
     builtinAttributeSyntax[StandardNames.mAPIID.ToLower()] =
        new AttributeContext(this, StandardNames.mAPIID, Syntax.Lookup("2.5.5.9", 2, null));
     builtinAttributeSyntax[StandardNames.isMemberOfPartialAttributeSet.ToLower()] =
         new AttributeContext(this, StandardNames.isMemberOfPartialAttributeSet, Syntax.Boolean);
     builtinAttributeSyntax[StandardNames.extendedCharsAllowed.ToLower()] =
         new AttributeContext(this, StandardNames.extendedCharsAllowed, Syntax.Boolean);
     builtinAttributeSyntax[StandardNames.linkID.ToLower()] =
         new AttributeContext(this, StandardNames.linkID, Syntax.Lookup("2.5.5.9", 2, null));
     builtinAttributeSyntax[StandardNames.mayContain.ToLower()] =
          new AttributeContext(this, StandardNames.mayContain, Syntax.Lookup("2.5.5.2", 6, null), false, null);
     builtinAttributeSyntax[StandardNames.systemMayContain.ToLower()] =
         new AttributeContext(this, StandardNames.systemMayContain, Syntax.Lookup("2.5.5.2", 6, null), false, null);
     builtinAttributeSyntax[StandardNames.possSuperiors.ToLower()] =
         new AttributeContext(this, StandardNames.possSuperiors, Syntax.Lookup("2.5.5.2", 6, null), false, null);
     builtinAttributeSyntax[StandardNames.defaultHidingValue.ToLower()] =
         new AttributeContext(this, StandardNames.defaultHidingValue, Syntax.Boolean);
     builtinAttributeSyntax[StandardNames.defaultObjectCategory.ToLower()] =
         new AttributeContext(this, StandardNames.defaultObjectCategory, Syntax.Lookup("2.5.5.1", 127, "1.3.12.2.1011.28.0.714"));          
 }
Esempio n. 20
0
    public override void Spawn(MapContainer map, MapTile tile)
    {
        mapContainer       = map;
        posx               = tile.posx;
        posy               = tile.posy;
        currentTile        = mapContainer.GetTile(posx, posy);
        transform.position = currentTile.transform.position;

        tile.currentCharacter = this;
    }
Esempio n. 21
0
        internal static void Update_MapContainer_MarkerSourceActivities(MapContainer mapContainer, ActivityCollection localCollection, ActivityCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceActivityValue);
            var locationActivities =
                masterCollection.CollectionContent.Select(
                    activity => new { Activity = activity, Locations = activity.LocationCollection.GetIDSelectedArray() });
            Dictionary <string, LocationSpot> locDict = new Dictionary <string, LocationSpot>();

            foreach (var locAct in locationActivities)
            {
                foreach (var location in locAct.Locations)
                {
                    string       key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if (locSpot == null)
                    {
                        locSpot = new LocationSpot {
                            LocationText = key, Location = location.Location
                        };
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddActivity(locAct.Activity);
                }
            }
            List <MapMarker> markers = new List <MapMarker>();

            foreach (var dictItem in locDict)
            {
                var locSpot = dictItem.Value;
                foreach (var catItem in locSpot.CategorizedActivites)
                {
                    MapMarker marker = MapMarker.CreateDefault();
                    marker.Location     = locSpot.Location;
                    marker.MarkerSource = MapMarker.MarkerSourceActivityValue;
                    marker.IconUrl      = GetIconUrlForCategory(catItem.CategoryName);
                    marker.CategoryName = GetMarkerCategoryName(catItem.CategoryName);
                    //marker.IconUrl = "../oip-additions/oip-assets/oip-images/oip-markers/OIP-marker-meeting.png";
                    marker.LocationText = locSpot.LocationText;
                    marker.SetLocationTextFromLocation(locSpot.Location);
                    marker.PopupTitle = catItem.GetCategoryTitle();
                    StringBuilder strBuilder = new StringBuilder();
                    foreach (var act in catItem.Activities)
                    {
                        ReferenceToInformation referenceToInformation = act.ReferenceToInformation;
                        appendMarkerLink(strBuilder, referenceToInformation);
                    }
                    marker.PopupContent = strBuilder.ToString();
                    markers.Add(marker);
                }
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }
Esempio n. 22
0
        public void Headquarter_AfterConstructor_OccupiedTileOwnershipShouldBeTheSameAsHeadquarter()
        {
            //Arrange
            _map = _tools.GenerateMap(3, 3, TerrainId.Mountain);
            Entity headquarter = _tools.AddAllyEntityAndChangeTerrainToGrass(1, 1, EntityId.Headquarter);

            //Act

            //Assert
            Assert.IsTrue(headquarter.ClanInfo.Id == _map.Tiles[1, 1].ClanOwnershipId);
        }
Esempio n. 23
0
 public static void SaveAllToSQL()
 {
     foreach (NetConnection Connection in ServerNetworkSceneComponent.GetNetServer().Connections)
     {
         LoginManagerServer user = MapContainer.GetLoginByID(Connection.RemoteUniqueIdentifier);
         if (user != null && user.GetCharacter() != null)
         {
             UpdateToSQL(user.username, user.GetCharacter().CreateJsonFromCharacter());
         }
     }
 }
Esempio n. 24
0
    public void CreateStageMap(MapContainer mapContainer)
    {
        Vector3 connerPointA = Vector3.zero;
        Vector3 connerPointB = Vector3.zero;
        Vector3 connerPointC = Vector3.zero;
        Vector3 connerPointD = Vector3.zero;

        for (int i = 0; i < m_MapHexList.Count; i++)
        {
            Destroy(m_MapHexList[i].gameObject);
        }

        m_MapHex     = new List <List <HexTile> >();
        m_MapHexList = new List <HexTile>();
        ////Hexagons
        for (int j = 0; j < mapContainer.sizeY; j++)
        {
            int            offset = j >> 1;
            List <HexTile> row    = new List <HexTile>();
            for (int i = -offset; i < mapContainer.sizeX - offset; i++)
            {
                if ((j & 1) == 1 && i == mapContainer.sizeX - offset - 1)
                {
                    continue;
                }
                HexTile  tile     = Instantiate(TilePrefabHolder.m_Instance.m_HexTileBasePrefab, m_MapTransform);
                TileData tileData = mapContainer.m_TileDataMap[i][j];
                tile.TileInitialize(tileData);
                row.Add(tile);
                m_MapHexList.Add(tile);
                if (j == 0)
                {
                    if (i == 0)
                    {
                        connerPointA = tile.HexTilePos();
                    }
                    else if (i == mapContainer.sizeX - offset - 1)
                    {
                        connerPointB = tile.HexTilePos();
                    }
                }
            }
            m_MapHex.Add(row);
        }

        for (int i = 0; i < m_MapHexList.Count; i++)
        {
            m_MapHexList[i].GameSetting();
        }
        connerPointD = new Vector3(0, 0, -mapContainer.sizeY + 1);
        connerPointC = new Vector3(connerPointB.x, 0, connerPointD.z);

        m_GameUIManager.m_ScreenControlUI.SetLimitPoint(connerPointA, connerPointB, connerPointC, connerPointD);
    }
Esempio n. 25
0
        public override void Init(MapContainer map)
        {
            Map = map;
            Map.GetType(MapItemTypes.Group, out var groupsStart, out var groupsNum);
            Map.GetType(MapItemTypes.Layer, out var layersStart, out var layersNum);

            GroupsStart = groupsStart;
            GroupsNum   = groupsNum;
            LayersStart = layersStart;
            LayersNum   = layersNum;

            for (var g = 0; g < GroupsNum; g++)
            {
                var group = GetGroup(g);

                for (var l = 0; l < group.NumLayers; l++)
                {
                    var layer = GetLayer(group.StartLayer + l);

                    if (layer.Type == LayerType.Tiles)
                    {
                        var tilemap = Map.GetItem <MapItemLayerTilemap>(
                            LayersStart + group.StartLayer + l,
                            out _,
                            out _
                            );

                        if ((tilemap.Flags & 1) == 0) // TILESLAYERFLAG_GAME
                        {
                            continue;
                        }

                        GameLayer = tilemap;
                        GameGroup = group;

                        GameGroup.OffsetX   = 0;
                        GameGroup.OffsetY   = 0;
                        GameGroup.ParallaxX = 100;
                        GameGroup.ParallaxY = 100;

                        if (GameGroup.Version >= 2)
                        {
                            GameGroup.UseClipping = 0;
                            GameGroup.ClipX       = 0;
                            GameGroup.ClipY       = 0;
                            GameGroup.ClipW       = 0;
                            GameGroup.ClipH       = 0;
                        }

                        break;
                    }
                }
            }
        }
Esempio n. 26
0
    public override void Spawn(MapContainer map, MapTile tile)
    {
        mapContainer  = map;
        currentTile   = tile;
        posx          = tile.posx;
        posy          = tile.posy;
        moveDirection = tile.faceDirection;

        transform.position = currentTile.transform.position;

        tile.currentCharacter = this;
    }
Esempio n. 27
0
        private void DamageTarget(NetIncomingMessage message, MessageTemplate template)
        {
            CharacterPlayer character = MapContainer.FindCharacterByID(message.SenderConnection.RemoteUniqueIdentifier);
            AbilityHead     abi       = AbilityContainer.GetAbilityByName(template.JsonMessage);
            Entity          entity    = Scene.FindEntity(character._name);
            PlayerComponent pcomp     = entity.GetComponent <PlayerComponent>();

            if (pcomp != null && abi != null && pcomp.Target != null)
            {
                pcomp.Target.GetComponent <DamageComponent>().DealDamageToEntity(abi.BaseDamage);
            }
        }
Esempio n. 28
0
        public void GetResult_SurroundedByAllImpassableTiles_ResultShouldContainFree0Allies0Enemies0()
        {
            //Arange
            _map = _tools.GenerateMap(3, 3, TerrainId.Water);
            Entity entity = _tools.AddAllyEntityAndChangeTerrainToGrass(1, 1, EntityId.Headquarter);

            //Act
            var result = _vision.GetResult(entity);

            //Assert
            Assert.IsTrue((result.NumberOfFreeTiles == 0) && (result.NumberOfAllies == 0) && (result.NumberOfEnemies == 0));
        }
Esempio n. 29
0
        public void CalculateStep_AfterSpawnTresholdTriggersAndThereIsNoSpaceForSpawning_TotalEntitiesOnMapShouldBe1()
        {
            //Arrange
            _map = _tools.GenerateMap(3, 3, TerrainId.Mountain);
            Entity headquarter = _tools.AddAllyEntityAndChangeTerrainToGrass(1, 1, EntityId.Headquarter);

            //Act
            headquarter.CalculateStep();

            //Assert
            Assert.IsTrue(_tools.CountEntitiesOnMap() == 1,
                          $"Found total: {_tools.CountEntitiesOnMap()} on map");
        }
Esempio n. 30
0
        public void GetResult_SurroundedByOneEnemyAndAllPassableTiles_ResultShouldContainFree7Allies0Enemies1()
        {
            //Arange
            _map = _tools.GenerateMap(3, 3, TerrainId.Grass);
            Entity entity = _tools.AddAllyEntity(1, 1, EntityId.Headquarter);
            Entity enemy  = _tools.AddEnemyEntity(0, 0, EntityId.Headquarter);

            //Act
            var result = _vision.GetResult(entity);

            //Assert
            Assert.IsTrue((result.NumberOfFreeTiles == 7) && (result.NumberOfAllies == 0) && (result.NumberOfEnemies == 1));
        }
Esempio n. 31
0
            private void Awake()
            {
                if (instance == null)
                {
                    instance = this;
                }
                else if (instance != null)
                {
                    Destroy(gameObject);
                }

                DontDestroyOnLoad(gameObject);
            }
        public SmbConnection()
        {
            isClientSupportExtSecurity = false;
            sutSignState = SignState.Disabled;
            sutCapabilities = new Set<Capabilities>();
            isNegotiateSent = false;
            sessionList = new MapContainer<int, SmbSession>();
            treeConnectList = new MapContainer<int, SmbTree>();

            SutNextReceiveSequenceNumber = 1;
            SutSendSequenceNumber = new SetContainer<int>();
            clientCapabilities = new Set<Capabilities>();

            openedFiles = new MapContainer<int, SmbFile>();
            openedPipes = new MapContainer<int, SmbPipe>();
            openedMailslots = new MapContainer<int, SmbMailslot>();
            sentRequest = new MapContainer<int, SmbRequest>();
            sessionId = 0;
            treeId = 0;
            fId = 0;
            searchHandlerContainer = new MapContainer<int, int>();
            clientSignState = SignState.Disabled;
            isSigningActive = false;
            accountType = AccountType.Admin;
        }
        internal static void Update_MapContainer_MarkerSourceActivities(MapContainer mapContainer, ActivityCollection localCollection, ActivityCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceActivityValue);
            var locationActivities =
                masterCollection.CollectionContent.Select(
                    activity => new {Activity = activity, Locations = activity.LocationCollection.GetIDSelectedArray()});
            Dictionary<string, LocationSpot> locDict = new Dictionary<string, LocationSpot>();
            foreach(var locAct in locationActivities)
            {
                foreach(var location in locAct.Locations)
                {
                    string key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if(locSpot == null)
                    {
                        locSpot = new LocationSpot {LocationText = key, Location = location.Location};
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddActivity(locAct.Activity);
                }
            }
            List<MapMarker> markers = new List<MapMarker>();
            foreach(var dictItem in locDict)
            {
                var locSpot = dictItem.Value;
                foreach(var catItem in locSpot.CategorizedActivites)
                {
                    MapMarker marker = MapMarker.CreateDefault();
                    marker.Location = locSpot.Location;
                    marker.MarkerSource = MapMarker.MarkerSourceActivityValue;
                    marker.IconUrl = GetIconUrlForCategory(catItem.CategoryName);
                    marker.CategoryName = GetMarkerCategoryName(catItem.CategoryName);
                    //marker.IconUrl = "../oip-additions/oip-assets/oip-images/oip-markers/OIP-marker-meeting.png";
                    marker.LocationText = locSpot.LocationText;
                    marker.SetLocationTextFromLocation(locSpot.Location);
                    marker.PopupTitle = catItem.GetCategoryTitle();
                    StringBuilder strBuilder = new StringBuilder();
                    foreach(var act in catItem.Activities)
                    {
                        ReferenceToInformation referenceToInformation = act.ReferenceToInformation;
                        appendMarkerLink(strBuilder, referenceToInformation);
                    }
                    marker.PopupContent = strBuilder.ToString();
                    markers.Add(marker);
                }
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }
        internal static void Update_MapContainer_MarkerSourceBlogs(MapContainer mapContainer, BlogCollection localCollection, BlogCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceBlogValue);
            var locationBlogs =
                masterCollection.CollectionContent.Select(
                    blog => new { Blog = blog, Locations = blog.LocationCollection.GetIDSelectedArray() });
            Dictionary<string, LocationSpot> locDict = new Dictionary<string, LocationSpot>();
            foreach (var locBlog in locationBlogs)
            {
                foreach (var location in locBlog.Locations)
                {
                    string key = location.Location.GetLocationText();
                    LocationSpot locSpot;
                    locDict.TryGetValue(key, out locSpot);
                    if (locSpot == null)
                    {
                        locSpot = new LocationSpot { LocationText = key, Location = location.Location };
                        locDict.Add(key, locSpot);
                    }
                    locSpot.AddBlog(locBlog.Blog);
                }
            }
            List<MapMarker> markers = new List<MapMarker>();
            foreach (var dictItem in locDict)
            {
                var locSpot = dictItem.Value;
                MapMarker marker = MapMarker.CreateDefault();
                marker.Location = locSpot.Location;
                marker.MarkerSource = MapMarker.MarkerSourceBlogValue;
                marker.IconUrl = GetIconUrlForCategory("News");
                marker.CategoryName = GetMarkerCategoryName("News");
                marker.LocationText = locSpot.LocationText;
                marker.SetLocationTextFromLocation(locSpot.Location);
                marker.PopupTitle = "News";
                StringBuilder strBuilder = new StringBuilder();
                foreach (var blogItem in locSpot.Blogs)
                {
                    ReferenceToInformation referenceToInformation = blogItem.ReferenceToInformation;
                    appendMarkerLink(strBuilder, referenceToInformation);
                }
                marker.PopupContent = strBuilder.ToString();
                markers.Add(marker);
            }

            mapContainer.MapMarkers.CollectionContent.AddRange(markers);
        }
        internal static void Update_MapContainer_MarkerSourceLocations(MapContainer mapContainer, AddressAndLocationCollection localCollection, AddressAndLocationCollection masterCollection)
        {
            mapContainer.MapMarkers.CollectionContent.RemoveAll(
                marker => marker.MarkerSource == MapMarker.MarkerSourceLocationValue);
            return;
            var mapMarkersFromLocation = masterCollection.CollectionContent.
                Select(loc =>
                           {
                               MapMarker marker = MapMarker.CreateDefault();
                               marker.Location = loc.Location;
                               marker.MarkerSource = MapMarker.MarkerSourceLocationValue;
                               marker.IconUrl = "../oip-additions/oip-assets/oip-images/oip-markers/OIP-marker-1.png";
                               marker.SetLocationTextFromLocation(loc.Location);
                               return marker;

                           }).ToArray();
            mapContainer.MapMarkers.CollectionContent.AddRange(mapMarkersFromLocation);
        }