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