示例#1
0
    /// <summary>
    /// Updates the map for the specified level no
    /// </summary>
    /// <param name="LevelNo">Level no.</param>
    public static void UpdateMap(int LevelNo)
    {
        WindowDetect.InMap    = true;//turns on blocking collider.
        instance.CurrentWorld = GameWorldController.GetWorld(LevelNo);
        ///Sets the map no display
        UWHUD.instance.LevelNoDisplay.text = (1 + (LevelNo - (int)instance.CurrentWorld)).ToString() + " " + instance.CurrentWorld + " (" + LevelNo + ")";
        if (_RES == GAME_UW2)
        {
            for (int i = 0; i <= instance.MapSelectButtons.GetUpperBound(0); i++)
            {
                if (instance.MapSelectButtons[i] != null)
                {
                    if (instance.MapSelectButtons[i].world == instance.CurrentWorld)
                    {
                        instance.MapSelectButtons[i].SetOn();
                    }
                    else
                    {
                        instance.MapSelectButtons[i].SetOff();
                    }
                }
            }
        }
        MapInteraction.MapNo              = LevelNo;
        UWHUD.instance.CursorIcon         = UWHUD.instance.MapQuill;
        UWHUD.instance.MapDisplay.texture = GameWorldController.instance.AutoMaps[MapInteraction.MapNo].TileMapImage();

        ///Display the map notes
        ///Delete the map notes in memory
        foreach (Transform child in UWHUD.instance.MapPanel.transform)
        {
            if (child.name.Substring(0, 4) == "_Map")
            {
                GameObject.Destroy(child.transform.gameObject);
            }
        }
        if (GameWorldController.instance.AutoMaps[MapInteraction.MapNo] != null)
        {
            if (GameWorldController.instance.AutoMaps[MapInteraction.MapNo].MapNotes != null)
            {
                for (int i = 0; i < GameWorldController.instance.AutoMaps[MapInteraction.MapNo].MapNotes.Count; i++)
                {///Instantiates the map note template UI control.
                    GameObject myObj = (GameObject)GameObject.Instantiate(Resources.Load("Prefabs/_MapNoteTemplate"));
                    myObj.name                       = "_Map-Note Number " + i;
                    myObj.transform.parent           = UWHUD.instance.MapPanel.transform;
                    myObj.GetComponent <Text>().text = GameWorldController.instance.AutoMaps[MapInteraction.MapNo].MapNotes[i].NoteText;
                    myObj.GetComponent <RectTransform>().anchoredPosition = GameWorldController.instance.AutoMaps[MapInteraction.MapNo].MapNotes[i].NotePosition();
                    myObj.GetComponent <MapNoteId>().guid = GameWorldController.instance.AutoMaps[MapInteraction.MapNo].MapNotes[i].guid;
                    //Move the control so that it sits in front of the map,
                    myObj.GetComponent <RectTransform>().SetSiblingIndex(4);
                }
            }
        }
    }
示例#2
0
    /// <summary>
    /// Gets the maximum no of levels for the current world.
    /// </summary>
    /// <param name="levelNo"></param>
    /// <returns></returns>
    int MaxWorld(int levelNo)
    {
        GameWorldController.Worlds world = GameWorldController.GetWorld(levelNo);
        switch (world)
        {
        case GameWorldController.Worlds.Britannia:
            if (_RES == GAME_UW2)
            {
                return((int)(GameWorldController.UW2_LevelNos.Britannia4));
            }
            else
            {
                return(GameWorldController.instance.AutoMaps.GetUpperBound(0));
            }

        case GameWorldController.Worlds.PrisonTower:
            return((int)(GameWorldController.UW2_LevelNos.Prison7));

        case GameWorldController.Worlds.Killorn:
            return((int)(GameWorldController.UW2_LevelNos.Killorn1));

        case GameWorldController.Worlds.Ice:
            return((int)(GameWorldController.UW2_LevelNos.Ice1));

        case GameWorldController.Worlds.Talorus:
            return((int)(GameWorldController.UW2_LevelNos.Talorus1));

        case GameWorldController.Worlds.Academy:
            return((int)(GameWorldController.UW2_LevelNos.Academy7));

        case GameWorldController.Worlds.Tomb:
            return((int)(GameWorldController.UW2_LevelNos.Tomb3));

        case GameWorldController.Worlds.Pits:
            return((int)(GameWorldController.UW2_LevelNos.Pits2));

        case GameWorldController.Worlds.Ethereal:
        //return (int)(GameWorldController.UW2_LevelNos.Ethereal8);
        default:
            return(GameWorldController.instance.AutoMaps.GetUpperBound(0));
        }
    }
    /// <summary>
    /// Prints what world you are in for UW2
    /// </summary>
    private static void GetLabyrinthOfWorldsLevel()
    {
        GameWorldController.Worlds world = GameWorldController.GetWorld(GameWorldController.instance.LevelNo);
        switch (world)
        {
        case GameWorldController.Worlds.Britannia:
            //TODO: At start of game the fact your are in Britannia is not printed.
            UWHUD.instance.MessageScroll.Add(
                StringController.instance.GetString(1, 73)
                + StringController.instance.GetString(1, 75));
            break;

        case GameWorldController.Worlds.PrisonTower:
            GetWorldKnowledgeString(0, 76); break;

        case GameWorldController.Worlds.Killorn:
            GetWorldKnowledgeString(1, 77); break;

        case GameWorldController.Worlds.Ice:
            GetWorldKnowledgeString(2, 78); break;

        case GameWorldController.Worlds.Talorus:
            GetWorldKnowledgeString(3, 79); break;

        case GameWorldController.Worlds.Academy:
            GetWorldKnowledgeString(4, 80); break;

        case GameWorldController.Worlds.Pits:
            GetWorldKnowledgeString(5, 82); break;

        case GameWorldController.Worlds.Tomb:
            GetWorldKnowledgeString(6, 81); break;

        case GameWorldController.Worlds.Ethereal:
            GetWorldKnowledgeString(7, 83); break;
        }
    }