Exemplo n.º 1
0
        private ListCollectionView CreatePositionFilteredItemsView(ButtonPosition position)
        {
            return new ListCollectionView(Items)
            {
                Filter = item =>
                {
                    var button = item as NavigationButton;
                    if (button != null)
                    {
                        return button.Position == position;
                    }

                    return false;
                },
                LiveFilteringProperties = { "Position" },
                IsLiveFiltering = true
            };
        }
Exemplo n.º 2
0
 void Awake()
 {
     me = this;
 }
        private void SetButtonPosition(ButtonPosition buttonPosition)
        {
            switch (buttonPosition)
            {
                case ButtonPosition.TopLeft:
                    spButtons.VerticalAlignment = VerticalAlignment.Top;
                    spButtons.HorizontalAlignment = HorizontalAlignment.Left;
                    spButtons.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    break;
                case ButtonPosition.TopCenter:
                    spButtons.VerticalAlignment = VerticalAlignment.Top;
                    spButtons.HorizontalAlignment = HorizontalAlignment.Center;
                    spButtons.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    break;
                case ButtonPosition.TopRight:
                    spButtons.VerticalAlignment = VerticalAlignment.Top;
                    spButtons.HorizontalAlignment = HorizontalAlignment.Right;
                    spButtons.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    break;
                case ButtonPosition.LeftCenter:
                    spButtons.VerticalAlignment = VerticalAlignment.Center;
                    spButtons.HorizontalAlignment = HorizontalAlignment.Left;
                    spButtons.Orientation = System.Windows.Controls.Orientation.Vertical;
                    break;
                case ButtonPosition.RightCenter:
                    spButtons.VerticalAlignment = VerticalAlignment.Center;
                    spButtons.HorizontalAlignment = HorizontalAlignment.Right;
                    spButtons.Orientation = System.Windows.Controls.Orientation.Vertical;
                    break;
                case ButtonPosition.BottomLeft:
                    spButtons.VerticalAlignment = VerticalAlignment.Bottom;
                    spButtons.HorizontalAlignment = HorizontalAlignment.Left;
                    spButtons.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    break;
                case ButtonPosition.BottomCenter:
                    spButtons.VerticalAlignment = VerticalAlignment.Bottom;
                    spButtons.HorizontalAlignment = HorizontalAlignment.Center;
                    spButtons.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    break;
                case ButtonPosition.BottomRight:
                    spButtons.VerticalAlignment = VerticalAlignment.Bottom;
                    spButtons.HorizontalAlignment = HorizontalAlignment.Right;
                    spButtons.Orientation = System.Windows.Controls.Orientation.Horizontal;
                    break;

            }
        }
Exemplo n.º 4
0
    public void LoadData()
    {
        ArrayList data = XMLHandler.LoadXML(dir+filename);

        int langs = DataHolder.Languages().GetDataCount();
        this.moneyText = new string[langs];
        this.timeText = new string[langs];
        this.itemCollectionText = new string[langs];
        this.itemCollectionYesText = new string[langs];
        this.itemCollectionNoText = new string[langs];
        this.dialogueOkText = new string[langs];
        this.dialogueOkSize = new Vector2[langs];
        this.dialogueOkOffset = new Vector2[langs];
        this.skillLevelName = new string[langs];
        this.moneyCollectionText = new string[langs];
        this.moneyCollectionYesText = new string[langs];
        this.moneyCollectionNoText = new string[langs];
        for(int i=0; i<langs; i++)
        {
            this.moneyText[i] = "% Money";
            this.timeText[i] = "Time: %";
            this.itemCollectionText[i] = "You found % %n!";
            this.itemCollectionYesText[i] = "Take";
            this.itemCollectionNoText[i] = "Leave";
            this.dialogueOkText[i] = "Ok";
            this.dialogueOkSize[i] = new Vector2(100, 30);
            this.dialogueOkOffset[i] = new Vector2(0, 0);
            this.skillLevelName[i] = "%n Lvl %";
            this.moneyCollectionText[i] = "You found % money!";
            this.moneyCollectionYesText[i] = "Take";
            this.moneyCollectionNoText[i] = "Leave";
        }

        if(data.Count > 0)
        {
            foreach(Hashtable entry in data)
            {
                if(entry[XMLHandler.NODE_NAME] as string == GameSettingsData.GAMESETTINGS)
                {
                    if(entry.ContainsKey(XMLHandler.NODES))
                    {
                        ArrayList subs = entry[XMLHandler.NODES] as ArrayList;
                        foreach(Hashtable val in subs)
                        {
                            if(val[XMLHandler.NODE_NAME] as string == GameSettingsData.GAMESETTING)
                            {
                                if(val.ContainsKey("encryptdata")) encryptData = true;

                                if(val.ContainsKey("acceptkey")) acceptKey = val["acceptkey"] as string;
                                if(val.ContainsKey("cancelkey")) cancelKey = val["cancelkey"] as string;
                                if(val.ContainsKey("verticalkey")) verticalKey = val["verticalkey"] as string;
                                if(val.ContainsKey("horizontalkey")) horizontalKey = val["horizontalkey"] as string;
                                if(val.ContainsKey("scrollspeed")) scrollSpeed = float.Parse((string)val["scrollspeed"]);
                                if(val.ContainsKey("icon")) dialogueOkIconName = val["icon"] as string;
                                if(val.ContainsKey("itemcollectionpos")) itemCollectionPosition = int.Parse((string)val["itemcollectionpos"]);
                                if(val.ContainsKey("pausetime")) pauseTime = true;
                                if(val.ContainsKey("switchplayer")) switchPlayer = true;
                                if(val.ContainsKey("switchonlybp")) switchOnlyBP = true;
                                if(val.ContainsKey("freezepause")) freezePause = true;

                                if(val.ContainsKey("minrandomrange")) minRandomRange = float.Parse((string)val["minrandomrange"]);
                                if(val.ContainsKey("maxrandomrange")) maxRandomRange = float.Parse((string)val["maxrandomrange"]);

                                maxBattleParty = int.Parse((string)val["maxactiveparty"]);
                                cursorTimeout = float.Parse((string)val["cursortimeout"]);
                                if(val.ContainsKey("clicktimeout"))
                                {
                                    clickTimeout = float.Parse((string)val["clicktimeout"]);
                                }
                                gameControl = (GameControl)System.Enum.Parse(
                                        typeof(GameControl), (string)val["gamecontrol"]);
                                dialogueOkPosition = (ButtonPosition)System.Enum.Parse(
                                        typeof(ButtonPosition), (string)val["dialogueokposition"]);

                                if(val.ContainsKey("guisystemtype"))
                                {
                                    guiSystemType = (GUISystemType)System.Enum.Parse(
                                            typeof(GUISystemType), (string)val["guisystemtype"]);
                                }
                                if(val.ContainsKey("guifiltermode"))
                                {
                                    guiFilterMode = (FilterMode)System.Enum.Parse(
                                            typeof(FilterMode), (string)val["guifiltermode"]);
                                }
                                if(val.ContainsKey("guiimagestretch"))
                                {
                                    guiImageStretch = (GUIImageStretch)System.Enum.Parse(
                                            typeof(GUIImageStretch), (string)val["guiimagestretch"]);
                                }
                                if(val.ContainsKey("battletexturedelete"))
                                {
                                    battleTextureDelete = (TextureDelete)System.Enum.Parse(
                                            typeof(TextureDelete), (string)val["battletexturedelete"]);
                                }
                                if(val.ContainsKey("menutexturedelete"))
                                {
                                    menuTextureDelete = (TextureDelete)System.Enum.Parse(
                                            typeof(TextureDelete), (string)val["menutexturedelete"]);
                                }
                                if(val.ContainsKey("mipmapbias")) mipMapBias = float.Parse((string)val["mipmapbias"]);
                                if(val.ContainsKey("preloadfonts")) preloadFonts = true;
                                if(val.ContainsKey("preloadboxes")) preloadBoxes = true;
                                if(val.ContainsKey("preloadareanames")) preloadAreaNames = true;
                                if(val.ContainsKey("noscrollbar")) noScrollbar = true;
                                if(val.ContainsKey("noscrollbarthumb")) noScrollbarThumb = true;
                                if(val.ContainsKey("noautocollapse")) noAutoCollapse = true;
                                if(val.ContainsKey("hudrefreshframe")) hudRefreshFrame = true;
                                if(val.ContainsKey("autoremovelayer")) autoRemoveLayer = true;
                                if(val.ContainsKey("loopskilllevels")) loopSkillLevels = true;
                                if(val.ContainsKey("addskilllevel")) addSkillLevel = true;
                                if(val.ContainsKey("itemcollectionchoice")) itemCollectionChoice = true;
                                if(val.ContainsKey("moneycollectionchoice")) moneyCollectionChoice = true;
                                if(val.ContainsKey("hudrefreshrate"))
                                {
                                    hudRefreshRate = float.Parse((string)val["hudrefreshrate"]);
                                }
                                if(val.ContainsKey("maxclickdistance"))
                                {
                                    maxClickDistance = int.Parse((string)val["maxclickdistance"]);
                                }

                                if(val.ContainsKey("areanamepos"))
                                {
                                    this.showAreaNames = true;
                                    this.areaNamePosition = int.Parse((string)val["areanamepos"]);
                                    this.areaNameVisibleTime = float.Parse((string)val["areanametime"]);
                                }

                                if(val.ContainsKey("inputhandling"))
                                {
                                    this.inputHandling = (InputHandling)System.Enum.Parse(
                                            typeof(InputHandling), (string)val["inputhandling"]);
                                }

                                if(val.ContainsKey("playercomponents"))
                                {
                                    this.playerComponent = new string[int.Parse((string)val["playercomponents"])];
                                }

                                if(val.ContainsKey("spawndistance"))
                                {
                                    this.spawnParty = true;
                                    this.spawnDistance = float.Parse((string)val["spawndistance"]);
                                    BoolHelper.FromHashtable(val, "onlyinbattlearea", ref this.onlyInBattleArea);
                                    BoolHelper.FromHashtable(val, "spawnonlybp", ref this.spawnOnlyBP);
                                }

                                if(val.ContainsKey("partyfollow"))
                                {
                                    this.partyFollow = true;
                                }

                                if(val.ContainsKey("guiscalemode"))
                                {
                                    guiScaleMode = (GUIScaleMode)System.Enum.Parse(
                                            typeof(GUIScaleMode), (string)val["guiscalemode"]);
                                }

                                ArrayList s = val[XMLHandler.NODES] as ArrayList;
                                foreach(Hashtable ht in s)
                                {
                                    if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.DIALOGUEOK)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs)
                                        {
                                            dialogueOkSize[i] = new Vector2(float.Parse((string)ht["width"]),
                                                    float.Parse((string)ht["height"]));
                                            dialogueOkOffset[i] = new Vector2(float.Parse((string)ht["x"]),
                                                    float.Parse((string)ht["y"]));
                                            dialogueOkText[i] = ht[XMLHandler.CONTENT] as string;
                                        }
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.DIALOGUEOKICON)
                                    {
                                        dialogueOkIconName = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.DEFAULTSCREEN)
                                    {
                                        defaultScreen.x = float.Parse((string)ht["width"]);
                                        defaultScreen.y = float.Parse((string)ht["height"]);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CURSORAUDIO)
                                    {
                                        this.cursorMoveAudio = ht[XMLHandler.CONTENT] as string;
                                        this.cursorMoveVolume = float.Parse((string)ht["volume"]);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ACCEPTAUDIO)
                                    {
                                        this.acceptAudio = ht[XMLHandler.CONTENT] as string;
                                        this.acceptVolume = float.Parse((string)ht["volume"]);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CANCELAUDIO)
                                    {
                                        this.cancelAudio = ht[XMLHandler.CONTENT] as string;
                                        this.cancelVolume = float.Parse((string)ht["volume"]);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.FAILAUDIO)
                                    {
                                        this.failAudio = ht[XMLHandler.CONTENT] as string;
                                        this.failVolume = float.Parse((string)ht["volume"]);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.SKILLLEVELAUDIO)
                                    {
                                        this.skillLevelAudio = ht[XMLHandler.CONTENT] as string;
                                        this.skillLevelVolume = float.Parse((string)ht["volume"]);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.GAMEOVER)
                                    {
                                        this.gameOver.scene = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ITEMCOLLECTIONTEXT)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.itemCollectionText[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ITEMCOLLECTIONYESTEXT)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.itemCollectionYesText[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ITEMCOLLECTIONNOTEXT)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.itemCollectionNoText[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.DROPSETTINGS)
                                    {
                                        this.saveDrops = bool.Parse((string)ht["save"]);
                                        if(ht.ContainsKey("dropmask"))
                                        {
                                            this.dropOnGround = true;
                                            this.dropMask = int.Parse((string)ht["dropmask"]);
                                        }
                                        this.dropOffsetX = new Vector2(float.Parse((string)ht["x1"]), float.Parse((string)ht["x2"]));
                                        this.dropOffsetY = new Vector2(float.Parse((string)ht["y1"]), float.Parse((string)ht["y2"]));
                                        this.dropOffsetZ = new Vector2(float.Parse((string)ht["z1"]), float.Parse((string)ht["z2"]));
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ACCEPTKEY)
                                    {
                                        this.acceptKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CANCELKEY)
                                    {
                                        this.cancelKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.VERTICALKEY)
                                    {
                                        this.verticalKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.HORIZONTALKEY)
                                    {
                                        this.horizontalKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYTEXT)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.moneyText[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYICON)
                                    {
                                        this.moneyIconName = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.TIMETEXT)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.timeText[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.TIMEICON)
                                    {
                                        this.timeIconName = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.SKILLPLUSKEY)
                                    {
                                        this.skillPlusKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.SKILLMINUSKEY)
                                    {
                                        this.skillMinusKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.SKILLLEVELNAME)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.skillLevelName[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CHARPLUSKEY)
                                    {
                                        this.charPlusKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CHARMINUSKEY)
                                    {
                                        this.charMinusKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.PLAYERCOMPONENT)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < this.playerComponent.Length) this.playerComponent[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.PLAYERCONTROLSETTINGS)
                                    {
                                        this.playerControlSettings.SetData(ht);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.CAMERACONTROLSETTINGS)
                                    {
                                        this.cameraControlSettings.SetData(ht);
                                        this.cameraControlSettings.mouseTouch.mode = MouseTouch.MOVE;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYPREFAB)
                                    {
                                        this.moneyPrefabName = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYCOLLECTIONTEXT)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.moneyCollectionText[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYCOLLECTIONYES)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.moneyCollectionYesText[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.MONEYCOLLECTIONNO)
                                    {
                                        int i = int.Parse((string)ht["id"]);
                                        if(i < langs) this.moneyCollectionNoText[i] = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.ITEMCOLLECTIONANIMATION)
                                    {
                                        this.itemCollectionAnimation = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.PAUSEKEY)
                                    {
                                        this.pauseKey = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.INTERACTIONCONTROLLER)
                                    {
                                        this.addInteractionController = true;
                                        this.interactionControllerName = ht[XMLHandler.CONTENT] as string;
                                        this.interactionControllerOffset = VectorHelper.FromHashtable(ht);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.INTERACTIONCONTROLLERCHILD)
                                    {
                                        this.interactionControllerChildName = ht[XMLHandler.CONTENT] as string;
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.STATISTIC)
                                    {
                                        this.statistic.SetData(ht);
                                    }
                                    else if(ht[XMLHandler.NODE_NAME] as string == GameSettingsData.GAMEOVERSETTINGS)
                                    {
                                        this.gameOver.SetData(ht);
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
Exemplo n.º 5
0
			public ButtonInfo( ButtonPosition position, ButtonGraphic graphic, int buttonID )
			{
				m_Position = position;
				m_Graphic = graphic;
				m_ButtonID = buttonID;
			}
Exemplo n.º 6
0
		public void RegisterButton( ButtonPosition position, ButtonGraphic graphic, int buttonID )
		{
			m_Buttons.Add( new ButtonInfo( position, graphic, buttonID ) );
		}