Changeset 65

User picture

Author: Ernest Pazera

(2010/02/28 01:19) About 2 years ago


  

Affected files

Updated HamQuestSL/HamQuestSLClient/MainPage.xaml.cs Download diff

6465
42
        List<List<Image>> inventoryStateImages;
42
        List<List<Image>> inventoryStateImages;
43
        List<List<Image>> inventoryImages;
43
        List<List<Image>> inventoryImages;
44
        List<List<TextBlock>> inventoryTextBlocks;
44
        List<List<TextBlock>> inventoryTextBlocks;
45
        List<List<TextBlock>> shadowTextBlocks;
45
        List<Image> statImages;
46
        List<Image> statImages;
46
        List<TextBlock> statTextBlocks;
47
        List<TextBlock> statTextBlocks;
47
        List<TextBlock> messageTextBlocks;
48
        List<TextBlock> messageTextBlocks;
...
...
64
            inventoryStateImages = new List<List<Image>>();
65
            inventoryStateImages = new List<List<Image>>();
65
            inventoryImages = new List<List<Image>>();
66
            inventoryImages = new List<List<Image>>();
66
            inventoryTextBlocks = new List<List<TextBlock>>();
67
            inventoryTextBlocks = new List<List<TextBlock>>();
68
            shadowTextBlocks = new List<List<TextBlock>>();
67
            while (inventorySelectImages.Count < 5)
69
            while (inventorySelectImages.Count < 5)
68
            {
70
            {
69
                List<Image> cellColumn = new List<Image>();
71
                List<Image> cellColumn = new List<Image>();
...
...
109
                while (textBlockColumn.Count < 7)
111
                while (textBlockColumn.Count < 7)
110
                {
112
                {
111
                    TextBlock textBlock = new TextBlock();
113
                    TextBlock textBlock = new TextBlock();
112
                    textBlock.Foreground = new SolidColorBrush(Color.FromArgb(255,0,128,128));
114
                    textBlock.Foreground = new SolidColorBrush(Color.FromArgb(255,0,255,255));
113
                    textBlock.FontWeight = FontWeights.ExtraBlack;
115
                    textBlock.FontWeight = FontWeights.ExtraBlack;
116
                    textBlock.Margin = new Thickness(1);
114
                    inventoryPanel.Children.Add(textBlock);
117
                    inventoryPanel.Children.Add(textBlock);
118
                    Grid.SetColumn(textBlock, shadowTextBlocks.Count);
119
                    Grid.SetRow(textBlock, textBlockColumn.Count);
120
                    Grid.SetColumnSpan(textBlock, 1);
121
                    Grid.SetRowSpan(textBlock, 1);
122
                    textBlockColumn.Add(textBlock);
123
                }
124
                shadowTextBlocks.Add(textBlockColumn);
125
                textBlockColumn = new List<TextBlock>();
126
                while (textBlockColumn.Count < 7)
127
                {
128
                    TextBlock textBlock = new TextBlock();
129
                    textBlock.Foreground = new SolidColorBrush(Color.FromArgb(255, 0, 0, 0));
130
                    textBlock.FontWeight = FontWeights.ExtraBlack;
131
                    textBlock.Margin = new Thickness(0);
132
                    inventoryPanel.Children.Add(textBlock);
115
                    Grid.SetColumn(textBlock, inventoryTextBlocks.Count);
133
                    Grid.SetColumn(textBlock, inventoryTextBlocks.Count);
116
                    Grid.SetRow(textBlock, textBlockColumn.Count);
134
                    Grid.SetRow(textBlock, textBlockColumn.Count);
117
                    Grid.SetColumnSpan(textBlock, 1);
135
                    Grid.SetColumnSpan(textBlock, 1);
...
...
405
                    inventoryStateImages[column][row].Visibility = Visibility.Collapsed;
423
                    inventoryStateImages[column][row].Visibility = Visibility.Collapsed;
406
                    inventoryImages[column][row].Visibility = Visibility.Collapsed;
424
                    inventoryImages[column][row].Visibility = Visibility.Collapsed;
407
                    inventoryTextBlocks[column][row].Visibility = Visibility.Collapsed;
425
                    inventoryTextBlocks[column][row].Visibility = Visibility.Collapsed;
426
                    shadowTextBlocks[column][row].Visibility = Visibility.Collapsed;
408
                }
427
                }
409
            }
428
            }
410
            foreach (string itemIdentifier in maze.PlayerDescriptor.Items.Identifiers)
429
            foreach (string itemIdentifier in maze.PlayerDescriptor.Items.Identifiers)
...
...
415
                inventoryStateImages[column][row].Visibility = Visibility.Visible;
434
                inventoryStateImages[column][row].Visibility = Visibility.Visible;
416
                inventoryImages[column][row].Visibility = Visibility.Visible;
435
                inventoryImages[column][row].Visibility = Visibility.Visible;
417
                inventoryTextBlocks[column][row].Visibility = Visibility.Visible;
436
                inventoryTextBlocks[column][row].Visibility = Visibility.Visible;
437
                shadowTextBlocks[column][row].Visibility = Visibility.Visible;
418
                Descriptor itemDescriptor = ItemTable.GetItemDescriptor(itemIdentifier);
438
                Descriptor itemDescriptor = ItemTable.GetItemDescriptor(itemIdentifier);
419
                if (maze.PlayerDescriptor.IsEquipped(itemIdentifier))
439
                if (maze.PlayerDescriptor.IsEquipped(itemIdentifier))
420
                {
440
                {
...
...
428
                }
448
                }
429
                inventoryImages[column][row].Source = new BitmapImage(new Uri(itemDescriptor.GetProperty<string>("imageUri"),
UriKind.Relative));
449
                inventoryImages[column][row].Source = new BitmapImage(new Uri(itemDescriptor.GetProperty<string>("imageUri"),
UriKind.Relative));
430
                inventoryTextBlocks[column][row].Text = string.Format("{0}", maze.PlayerDescriptor.Items[itemIdentifier]);
450
                inventoryTextBlocks[column][row].Text = string.Format("{0}", maze.PlayerDescriptor.Items[itemIdentifier]);
451
                shadowTextBlocks[column][row].Text = string.Format("{0}", maze.PlayerDescriptor.Items[itemIdentifier]);
431
                if (maze.PlayerDescriptor.IsEquipped(itemIdentifier))
452
                if (maze.PlayerDescriptor.IsEquipped(itemIdentifier))
432
                {
453
                {
433
                    float fraction = 0.0f;
454
                    float fraction = 0.0f;
...
...
674
            ShopState shopState = maze.PlayerDescriptor.ShopState;
695
            ShopState shopState = maze.PlayerDescriptor.ShopState;
675
            string itemIdentifier = shopState.ItemList[shopState.ItemIndex];
696
            string itemIdentifier = shopState.ItemList[shopState.ItemIndex];
676
            Descriptor descriptor = ItemTable.GetItemDescriptor(itemIdentifier);
697
            Descriptor descriptor = ItemTable.GetItemDescriptor(itemIdentifier);
677
            maze.PlayerDescriptor.Gold -= descriptor.GetProperty<uint>(GameConstants.Properties.Price);
698
            maze.PlayerDescriptor.Gold -= (uint)descriptor.GetProperty<int>(GameConstants.Properties.Price);
678
            shopState.ShopItems.Remove(itemIdentifier);
699
            shopState.ShopItems.Remove(itemIdentifier);
679
            maze.PlayerDescriptor.AddItem(itemIdentifier);
700
            maze.PlayerDescriptor.AddItem(itemIdentifier);
680
            drawShop();
701
            drawShop();
...
...
690
            Descriptor descriptor = ItemTable.GetItemDescriptor(itemIdentifier);
711
            Descriptor descriptor = ItemTable.GetItemDescriptor(itemIdentifier);
691
            while (shopState.ShopItems[itemIdentifier]>0)
712
            while (shopState.ShopItems[itemIdentifier]>0)
692
            {
713
            {
693
                maze.PlayerDescriptor.Gold -= descriptor.GetProperty<uint>(GameConstants.Properties.Price);
714
                maze.PlayerDescriptor.Gold -= (uint)descriptor.GetProperty<int>(GameConstants.Properties.Price);
694
                shopState.ShopItems.Remove(itemIdentifier);
715
                shopState.ShopItems.Remove(itemIdentifier);
695
                maze.PlayerDescriptor.AddItem(itemIdentifier);
716
                maze.PlayerDescriptor.AddItem(itemIdentifier);
696
            }
717
            }