Beispiel #1
0
    // 스테이지 변경 이벤트
    public void OnStagePanelChanged()
    {
        int stageNumber = ScrollSnapMapView.GetComponent <SimpleScrollSnap>().TargetPanel + 1;

        currentMapId = MapSystem.GetCurrentMapId(stageNumber);
        // 현재 패널의 스테이지가 자신의 스테이지 보다 같거나 작을때
        if (stageNumber <= MapSystem.GetMap(currentMapId).stageNumber)
        {
            mapNameText.text        = string.Format("{0} <size='40'>{1}</size>", MapSystem.GetStageName(stageNumber - 1), MapSystem.GetMap(currentMapId).name);
            mapDescriptionText.text = MapSystem.GetStageDescription(stageNumber - 1);
        }
        else
        {
            mapNameText.text        = MapSystem.GetStageName(stageNumber - 1);
            mapDescriptionText.text = string.Format("<color='red'>{0}</color>", LocalizationManager.GetText("MapWarningMessage"));
        }
        foreach (var node in mapNodeList)
        {
            if (node.Key == currentMapId)
            {
                mapNodeImage = node.Value.GetComponent <Image>();
                break;
            }
        }
        mapInfoPanel.GetComponent <AiryUIAnimatedElement>().ShowElement();
        ShowHero();
    }
Beispiel #2
0
 public void Init()
 {
     MapS = MapSystem.Instance;
     MapChange();
     DeckChange();
     PlayerLevelChange();
 }
Beispiel #3
0
        /// <summary>
        /// 尝试卸载Group,并决定卸载前是否,若取消卸载返回false
        /// </summary>
        public static bool UnLoadGroup(MapGroup group)
        {
            if (group == null)
            {
                return(true);
            }
            if (group.dirty)
            {
                switch (EditorUtility.DisplayDialogComplex("温馨小提示", "当前场景组未保存,是否保存该组?", "保存", "取消", "不保存"))
                {
                case 0:
                    SaveGroup(group);
                    MapSystem.UnLoadGroup(group);
                    return(true);

                case 2:
                    MapSystem.UnLoadGroup(group);
                    return(true);

                default:
                    return(false);
                }
            }
            else
            {
                MapSystem.UnLoadGroup(group);
                return(true);
            }
        }
    // Start is called before the first frame update
    void Start()
    {
        ready   = false;
        scriptM = (MapSystem)map.GetComponent(typeof(MapSystem));

        scriptP = (PickupSystem)pickupmap.GetComponent(typeof(PickupSystem));
    }
Beispiel #5
0
    public IEnumerator StageClearing()
    {
        isStartGame = false;
        isEndGame   = true;
        HeroSystem.SaveHeros(Common.FindAlly());
        MapSystem.MapClear(stageInfo.mapNumber, stageInfo.stageClearPoint);
        MissionSystem.AddClearPoint(MissionSystem.ClearType.StageClear);
        MissionSystem.AddClearPoint(MissionSystem.ClearType.TotalStageCount);
        MissionSystem.PointSave();
        SaveSystem.AddUserCoin(stageInfo.stageCoin);
        stageInfo.stageExp = Common.GetUserExp(stageInfo.stageNumber);
        SaveSystem.ExpUp(stageInfo.stageExp);
        var getItems = GetStageItems();

        for (var i = 0; i < getItems.Count; i++)
        {
            ItemSystem.SetObtainItem(getItems[i].id);
        }
        GoogleSignManager.SaveData();
        UI_Manager.instance.OpenEndGamePanel(true);
        if (UnityEngine.Random.Range(0, 10) < 2)
        {
            GoogleAdMobManager.instance.OnBtnViewAdClicked();
        }
        yield return(null);
    }
Beispiel #6
0
    private void Awake()
    {
        instance = this;

        for (int i = 0; i < 2; i++)
        {
            nTree.CreateNode(1, GetRandomNode());
            nTree.Nodes[1][i].temp.transform.Translate(1 * i + 20, -1, 0);
        }
        for (int i = 0; i < 5; i++)
        {
            nTree.CreateNode(2, GetRandomNode());
            nTree.Nodes[2][i].temp.transform.Translate(1 * i + 20, -2, 0);
        }
        for (int i = 0; i < 10; i++)
        {
            nTree.CreateNode(3, GetRandomNode());
            nTree.Nodes[3][i].temp.transform.Translate(1 * i + 20, -3, 0);
        }
        for (int i = 0; i < 20; i++)
        {
            nTree.CreateNode(4, GetRandomNode());
            nTree.Nodes[4][i].temp.transform.Translate(1 * i + 20, -4, 0);
        }

        currentPos = nTree.Root;
        ConnectNextNode(currentPos);
    }
Beispiel #7
0
 void RefreshUI()
 {
     if (InfinityMode != null)
     {
         if (MapSystem.IsAbleInfinityMode())
         {
             InfinityMode.GetComponent <Button>().enabled = true;
             InfinityMode.transform.GetChild(2).GetComponent <Image>().enabled = false;
         }
         else
         {
             InfinityMode.GetComponent <Button>().enabled = false;
             InfinityMode.transform.GetChild(2).GetComponent <Image>().enabled = true;
         }
     }
     if (BossMode != null)
     {
         if (MapSystem.IsAbleBossMode())
         {
             BossMode.GetComponent <Button>().enabled = true;
             BossMode.transform.GetChild(2).GetComponent <Image>().enabled = false;
         }
         else
         {
             BossMode.GetComponent <Button>().enabled = false;
             BossMode.transform.GetChild(2).GetComponent <Image>().enabled = true;
         }
     }
 }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        if (!PauseMenu.GameIsPaused)
        {
            Vector3 moveInput = new Vector3(Input.GetAxisRaw(horizontalAxis), Input.GetAxisRaw(verticalAxis), 0);
            if (Mathf.Abs(target_angle - angle) < 1)
            {
                mag = Mathf.Clamp01(new Vector3(Input.GetAxis(horizontalAxis), Input.GetAxis(verticalAxis), 0).magnitude);
                if (MapSystem.Get_Tile_Type(transform.position, groundmap) == sandTile)
                {
                    groundSpeed = 0.5f;
                }
                else if (MapSystem.Get_Tile_Type(transform.position, groundmap) == grassTile)
                {
                    groundSpeed = 0.8f;
                }
                else
                {
                    groundSpeed = 1;
                }
                moveVelocity = moveInput.normalized * speed * groundSpeed * mag;
            }
            else
            {
                moveVelocity = new Vector3(0, 0, 0);
            }

            RotateTank();
        }
        if (health <= 0)
        {
            Die(0);
        }
    }
Beispiel #9
0
    private void Awake()
    {
        m_instance = this;

        m_subscriberList.Add(new Event <DoorUsedEvent> .Subscriber(OnDoorUse));
        m_subscriberList.Subscribe();
    }
Beispiel #10
0
    void StartNewRound()
    {
        currentRound++;
        currentLevelIndex++;

        if (!randomLevelOrder)
        {
            currentLevelIndex = MapSystem.Play_Map(tilemapGround, tilemapWall, tilemapObjects, tilemapTop, currentLevelIndex, tile_prefab_array, ground_tiles_array, wall_tiles_array, objects_tiles_array, top_tiles_array);
        }
        else
        {
            currentLevelIndex = MapSystem.Play_Map(tilemapGround, tilemapWall, tilemapObjects, tilemapTop, -1, tile_prefab_array, ground_tiles_array, wall_tiles_array, objects_tiles_array, top_tiles_array);
        }

        if (currentLevelIndex == -1)
        {
            Debug.Log("Couldn't find a map to load. (2)");
            SceneManager.LoadScene("MenuScene");
        }

        centerCamera();

        spawnPlayers();

        countdownUI.SetActive(true);
    }
Beispiel #11
0
    void Awake()
    {
        return;

        this._mapSystem       = new MapSystem();
        this._characterSystem = new CharacterSystem();
        this._itemSystem      = new ItemSystem();
        this._poolManager     = PoolManager.Instance;
    }
Beispiel #12
0
 private void Start()
 {
     HeroSystem.LoadHero();
     SkillSystem.LoadSkill();
     AbilitySystem.LoadAbility();
     ItemSystem.LoadItem();
     MapSystem.LoadMap();
     MissionSystem.LoadMission();
     LocalizationManager.LoadLanguage(User.language);
 }
Beispiel #13
0
        /// <summary>
        /// 判定鼠标所处区域
        /// </summary>
        private void SetMouseArea()
        {
            Vector2 mousePos = Event.current.mousePosition;

            //判断顺序=遮挡关系
            //判定选中物体
            MapGroup group = GroupList[MapSystem.currentGroupIndex];

            if (group != null)
            {
                for (int i = 0; i < group.transform.childCount; i++)
                {
                    Vector2 guiPos = GetElementGUIPos(group.transform.GetChild(i).position);

                    if (Vector2.Distance(mousePos, guiPos) < Prefs.elementRadius)
                    {
                        areaIndex = i;
                        mouseArea = MouseArea.ObjectArea;
                        return;
                    }
                }
            }
            for (int i = 0; i < invalidObjectList.Count; i++)
            {
                Vector2 guiPos = GetElementGUIPos(invalidObjectList[i].transform.position);

                if (Vector2.Distance(mousePos, guiPos) < Prefs.elementRadius)
                {
                    areaIndex = -i - 1;
                    mouseArea = MouseArea.ObjectArea;
                    return;
                }
            }
            //判定在中心
            if (Vector2.Distance(mousePos, center) < Prefs.centerDiscRadius)
            {
                mouseArea = MouseArea.Center;
                return;
            }
            //判定在缩放区域
            if (mousePos.x < Prefs.sideWidth)
            {
                mouseArea = MouseArea.ScollArea;
                return;
            }
            //判定选中组
            if (Vector2.Distance(mousePos, center) < radius)
            {
                areaIndex = (int)(MapSystem.GetAngle(GetElementWorldPos(Event.current.mousePosition, 0)) / MapSystem.AnglePerGroup);
                mouseArea = MouseArea.GroupArea;
                return;
            }

            mouseArea = MouseArea.DragArea;
        }
Beispiel #14
0
    // Start is called before the first frame update


    void Start()
    {
        ScriptM = (MapSystem)Map.GetComponent(typeof(MapSystem));
        count   = transform.childCount;
        locks   = new PuzzleGate[count];

        for (int i = 0; i < count; i++)
        {
            GameObject ci = this.gameObject.transform.GetChild(i).gameObject;
            locks[i] = (PuzzleGate)ci.GetComponent(typeof(PuzzleGate));
        }
    }
Beispiel #15
0
    void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(gameObject);
    }
Beispiel #16
0
    void Awake()
    {
        if (notifyMapSystemOnComplete)
        {
            msCaller = GameObject.FindWithTag("global").GetComponent <Global>().map;
        }

        //Start with a solid color if the image is fading from 1 to 0
        if (fadeDirection == FadeDirection.Out)
        {
            fadeOutUIImage.color = new Color(fadeOutUIImage.color.r, fadeOutUIImage.color.g, fadeOutUIImage.color.b, 1);
        }
        StartCoroutine(Fade());
    }
Beispiel #17
0
 public override void OnInspectorGUI()
 {
     base.OnInspectorGUI();
     if (EditorApplication.isPlaying)
     {
         if (GUILayout.Button("Generate"))
         {
             MapSystem.GenerateMap(MapSystem.ChooseMapGenerationInfo(0), 0);
         }
         if (GUILayout.Button("Init"))
         {
             MapSystem.InitGroupActiveState();
         }
     }
 }
Beispiel #18
0
        private float QuaternionToAngle(float y)
        {
            //四元数和角度的转换
            int index = MapSystem.currentGroupIndex % 3;

            if (y > 240 && index == 0)
            {
                return(MapSystem.Rotate(MapSystem.CurrentCircle * 360, y - 360));
            }
            else if (y < 120 && index == 2)
            {
                return(MapSystem.Rotate(MapSystem.CurrentCircle * 360, y + 360));
            }
            return(MapSystem.CurrentCircle * 360 + y);
        }
Beispiel #19
0
    private void Start()
    {
        isStartGame   = false;
        stageModeType = Common.stageModeType;
        MonsterCount  = 0;
        isEndGame     = false;
        kPoint        = 0;
        dPoint        = 0;
        userInfo      = new UserInfo();
        userInfo.initUserInfo();
        stageInfo = GameManagement.instance.GetStageInfo();
        stageInfo.initStage();
        if (stageModeType == Common.StageModeType.Main)
        {
            Map map = MapSystem.GetMap(stageInfo.mapNumber);
            SoundManager.instance.BgmSourceChange(AudioClipManager.instance.StageBgm);
            switch (map.stageType)
            {
            case 0:
                UI_Manager.instance.Title.GetComponentInChildren <Text>().text = LocalizationManager.GetText("stageTitleMainType1");
                InitCastle();
                break;

            case 1:
                UI_Manager.instance.Title.GetComponentInChildren <Text>().text = LocalizationManager.GetText("stageTitleMainType2");
                break;

            case 2:
                UI_Manager.instance.Title.GetComponentInChildren <Text>().text = LocalizationManager.GetText("stageTitleMainType3");
                InitBoss();
                break;
            }
            mapnameText.text = map.name;
            if (Map != null)
            {
                MapSystem.SetMapSprite(stageInfo.stageNumber, ref Map);
            }
        }
        else if (stageModeType == Common.StageModeType.Infinite)
        {
            SoundManager.instance.BgmSourceChange(AudioClipManager.instance.StageBgm);
            UI_Manager.instance.Title.GetComponentInChildren <Text>().text = LocalizationManager.GetText("stageTitleInfinity");
        }

        CharactersManager.instance.SetStagePositionHeros();
        StartCoroutine("StageStartEffect");
    }
Beispiel #20
0
        public MapViewport(int width, int height) : base(GameConstants.MapWidth, GameConstants.MapHeight)
        {
            Engine.ActiveConsole = this;
            Engine.UseMouse      = true;

            Engine.Keyboard.RepeatDelay        = 0.07f;
            Engine.Keyboard.InitialRepeatDelay = 0.1f;

            TextSurface.RenderArea = new Microsoft.Xna.Framework.Rectangle(0, 0, width, height);

            Fill(null, Colors.DefaultBG, null);

            renderer = new RenderingSystem(this);

            map = new MapSystem(GameConstants.MapWidth, GameConstants.MapHeight);
            //ComponentManager.AddComponent( EntityManager.Map, map );
        }
Beispiel #21
0
 // 맵노드 클릭 이벤트
 public void OnMapNodeClick(int mapId, int index)
 {
     SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default);
     if (MapSystem.isAbleMap(mapId))
     {
         currentMapId = GetMapId(index);
         Debugging.Log(index + "번째 노드클릭");
         mapNodeImage = ContentView.transform.GetChild(index).GetComponent <Image>();
         this.GetComponentInChildren <SimpleScrollSnap>().GoToPanel(index);
         ShowMapInfo(mapId);
         ShowHero();
     }
     else
     {
         Debugging.Log(mapId + " 의 맵은 아직 열리지 않은 맵입니다.");
     }
 }
Beispiel #22
0
        public Game(Context ctx)
        {
            this.ctx = ctx;

            state = GameState.UNDEFINED;

            systems = new GameSystems();
            systems.Add(new AnimSystem());
            systems.Add(new MovementSystem());
            systems.Add(new MapSystem(ctx.config.Get <MapSystemConfig>()));
            systems.Add(new CameraSystem());
            systems.Add(new EntitySystem());

            systems.Init(systems, ctx);

            ActionSystem actionSys = new ActionSystem(assemblyNames: "Game");

            actionSys.OnActionSystemRegistered += iActionSystem => {
                if (iActionSystem is IGameSystem gs)
                {
                    gs.Init(systems, ctx);
                }
            };
            actionSys.RegisterSystems();

            MapSystem mapSystem = systems.Get <MapSystem>();

            mapSystem.Load(new[] {
                0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
                0x1, 0xB, 0xB, 0xB, 0xB, 0x1000A, 0xB, 0xB, 0xB, 0x1, 0x1, 0x1,
                0x1, 0xB, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xB, 0x1, 0x1, 0x1,
                0x1, 0xB, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xB, 0x1, 0x1, 0x1,
                0x1, 0xB, 0xA, 0xA, 0xA, 0xA, 0xA, 0xA, 0xB, 0x1, 0x1, 0x1,
                0x1, 0xB, 0xB, 0xB, 0xB, 0xB, 0xB, 0xB, 0xB, 0x1, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
                0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1, 0x1,
            }, 12, "Entrance");

            player = systems.Get <EntitySystem>().CreatePlayer("Player");
            int spawnpoint = mapSystem.Map.Spawnpoint;

            player.SetLocalPosition(mapSystem.Map.IndexToWorldPos(spawnpoint));

            ctx.eventPump.Dispatch();
            // systems.Get<CameraSystem>().SetTarget(player.transform);
        }
Beispiel #23
0
 void CreateMapNodesI()
 {
     if (mapSlotNodePrefab != null)
     {
         for (int i = 0; i < ContentView.transform.childCount; i++)
         {
             this.GetComponentInChildren <SimpleScrollSnap>().Remove(i);
         }
         foreach (var mapNode in MapSystem.GetMapNodeAll())
         {
             if (mapNode != null)
             {
                 // 맵노드 생성
                 GameObject mapNodePrefab = mapSlotNodePrefab;
                 mapNodePrefab.name = mapNode.name;
                 this.GetComponentInChildren <SimpleScrollSnap>().AddToBack(mapNodePrefab);
             }
         }
     }
 }
Beispiel #24
0
    public static void AddMapClear(int clearId, int openId)
    {
        string      path   = Application.persistentDataPath + "/Xml/Map.Xml";
        XmlDocument xmlDoc = new XmlDocument();

        if (System.IO.File.Exists(path))
        {
            xmlDoc.LoadXml(System.IO.File.ReadAllText(path));
        }

        //복호화////
        XmlElement elmRoot     = xmlDoc.DocumentElement;
        var        decrpytData = DataSecurityManager.DecryptData(elmRoot.InnerText);

        elmRoot.InnerXml = decrpytData;
        //////////

        ChangeNode(MapSystem.GetUserMap(clearId), xmlDoc);
        CreateNode(MapSystem.GetMap(openId), xmlDoc, path);
    }
Beispiel #25
0
    // Start is called before the first frame update
    private void Awake()
    {
        if (Instance == null)
        {
            Instance = this;
            DontDestroyOnLoad(gameObject);
        }
        else
        {
            Destroy(gameObject);
        }

        map            = new MapSystem();
        map.global     = this;
        map.currentMap = startScene;
        map.setRepositionType(MapSystem.repositionTypes.none);

        audio = new AudioManager();
        audio.EffectsSource = audioEffectsSource;
        audio.MusicSource   = audioMusicSource;
        audio.Start(gameObject);
    }
Beispiel #26
0
    // Start is called before the first frame update
    void Start()
    {
        countdownUI.SetActive(true);

        SaveSystem.Init();

        // Get player controller bindings
        GameObject PCBinding = GameObject.Find("PCBinding");
        ControllerPlayerBinding cpBinding = PCBinding.GetComponent <ControllerPlayerBinding>();

        //player_info = cpBinding.getPlayerInfo();

        /* Possibly use constructor (maybe not a good idea) http://ilkinulas.github.io/development/unity/2016/05/30/monobehaviour-constructor.html
         * for (int i = 0; i < 0; i++)
         * {
         *  if (player_info[i, 0] != 0)
         *  {
         *      player = new PlayerController(player_info[i, 0], player_info[i, 1], player_info[i, 2]);
         *  }
         * }*/

        // Used to load specific map

        /*
         * if (cpBinding.getLevelPath() != null) MapSystem.Play_Selected_Map(tilemapGround, tilemapWall, tilemapObjects, tilemapTop, cpBinding.getLevelPath(), tile_prefab_array, ground_tiles_array, wall_tiles_array, objects_tiles_array, top_tiles_array);
         * else SceneManager.LoadScene("MenuScene");
         */
        currentLevelIndex = MapSystem.Play_Map(tilemapGround, tilemapWall, tilemapObjects, tilemapTop, -1, tile_prefab_array, ground_tiles_array, wall_tiles_array, objects_tiles_array, top_tiles_array);
        if (currentLevelIndex == -1)
        {
            Debug.Log("Couldn't find a map to load. (2)");
            SceneManager.LoadScene("MenuScene");
        }

        spawnPlayersFromLobby(cpBinding);

        centerCamera();
    }
Beispiel #27
0
        private static void AdjustUnit(MapUnit unit)
        {
            float          angle = MapSystem.GetAngle(unit.transform.position);
            MapGroup       group = unit.group;
            List <MapUnit> list  = group.unitList;

            if (MapSystem.SubSigned(angle, unit.angle) > 0)
            {
                for (int i = unit.index + 1; i < list.Count && list[i].angle < angle; i++)
                {
                    list[i - 1] = list[i];
                    list[i]     = unit;
                }
            }
            else
            {
                for (int i = unit.index - 1; i >= 0 && list[i].angle > angle; i--)
                {
                    list[i + 1] = list[i];
                    list[i]     = unit;
                }
            }
        }
Beispiel #28
0
        //这三个方法的核心是保证升序排列
        private static void AddUnit(MapUnit unit, MapGroup group)
        {
            unit.angle = MapSystem.GetAngle(unit.transform.position);
            unit.group = group;
            List <MapUnit> list = group.unitList;

            int i = 0;

            while (i < list.Count && list[i].angle < unit.angle)
            {
                i++;
            }

            list.Insert(i, unit);
            unit.index = i;

            for (int j = i + 1; j < list.Count; j++)
            {
                list[j].index = j;
            }

            group.dirty = true;
        }
Beispiel #29
0
 // 맵노드 클릭 이벤트
 public void OnMapNodeClick(int mapId)
 {
     SoundManager.instance.EffectSourcePlay(AudioClipManager.instance.ui_button_default);
     if (MapSystem.isAbleMap(mapId))
     {
         currentMapId     = mapId;
         mapNameText.text = string.Format("{0} <size='40'>{1}</size>", MapSystem.GetStageName(MapSystem.GetMap(currentMapId).stageNumber - 1), MapSystem.GetMap(currentMapId).name);
         foreach (var node in mapNodeList)
         {
             if (node.Key == mapId)
             {
                 mapNodeImage = node.Value.GetComponent <Image>();
                 break;
             }
         }
         mapInfoPanel.GetComponent <AiryUIAnimatedElement>().ShowElement();
         ShowHero();
     }
     else
     {
         Debugging.Log(mapId + " 의 맵은 아직 열리지 않은 맵입니다.");
     }
 }
Beispiel #30
0
        public GameController(Context ctx) : base(ctx)
        {
            _systems        = new Entitas.Systems();
            _indexsystem    = new IndexSystem(Contexts.sharedInstance.game);
            _mapsystem      = new MapSystem(Contexts.sharedInstance.game);
            _joinsystem     = new JoinSystem(Contexts.sharedInstance.game);
            _myplayersystem = new MyPlayerSystem(Contexts.sharedInstance.game);
            _systems.Add(_indexsystem)
            .Add(_mapsystem)
            .Add(_joinsystem)
            .Add(_myplayersystem);


            // 4, protocol
            _syncmsg1 = new byte[4];
            NetPack.Packli(_syncmsg1, 0, 1);

            EventListenerCmd listener2 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_MAP, SetupMap);

            _ctx.EventDispatcher.AddCmdEventListener(listener2);

            //EventListenerCmd listener3 = new EventListenerCmd(MyEventCmd.EVENT_SETUP_VIEW, SetupCamera);
            //_ctx.EventDispatcher.AddCmdEventListener(listener3);
        }