Changeset 6618 for 2015


Ignore:
Timestamp:
2015-06-30 16:54:44 (8 years ago)
Author:
empaheik
Message:
 
Location:
2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabriel.cs

    r6617 r6618  
    99using Jypeli.Widgets; 
    1010 
     11public class StoryItem 
     12{ 
     13    // Iso kuvake joka näkyy inventoryssä. 
     14    public Image InventoryImage { get; set; } 
     15 
     16    public Queue<string> Message { get; set; } 
     17 
     18    public StoryItem(Queue<String> message, Image image) 
     19    { 
     20        this.InventoryImage = image; 
     21        this.Message = message; 
     22    } 
     23} 
    1124 
    1225public partial class TheLegendOfGabriel : PhysicsGame 
     
    2639    Queue<string> messagesviewed; 
    2740 
     41    private const int STORYITEM_COUNT = 3; 
     42    StoryItem[] storyItem = new StoryItem[3]; 
     43 
    2844    #region Resources 
    2945 
     
    3147    public static Image LetterImage = LoadImage("letter"); 
    3248    public static Image SmallSwordImage = LoadImage("smallsword"); 
     49 
     50    public static Image FrameImage = LoadImage("frame"); 
    3351 
    3452    [AssetName("walkright")] 
     
    6381    public override void Begin() 
    6482    { 
     83        Mouse.IsCursorVisible = true; 
    6584        SmoothTextures = false; 
    6685        LoadAnimations(); 
    6786        StartGame(); 
    6887        Intro(); 
     88        BuildRightBar(); 
     89    } 
     90 
     91    void BuildRightBar() 
     92    { 
     93        for (int i = 0; i < STORYITEM_COUNT; i++) 
     94        { 
     95            GameObject member = new GameObject(FrameImage); 
     96            member.Position = new Vector(Level.Right + FrameImage.Width, Level.Top - Level.Width * 0.25 - FrameImage.Height * i * 1.5); 
     97            Add(member); 
     98 
     99            GameObject inner = new GameObject(TILE_SIZE, TILE_SIZE); 
     100            inner.Color = Color.Black; 
     101            if (storyItem[i] != null) 
     102            { 
     103                inner.Image = storyItem[i].InventoryImage; 
     104                Mouse.ListenOn(inner, MouseButton.Left, ButtonState.Pressed, ShowTextItem, "View those precious memories", storyItem[i]); 
     105            } 
     106            member.Add(inner); 
     107        } 
    69108    } 
    70109 
     
    87126    void Intro() 
    88127    { 
    89         ShowTextItem(LetterImage, new Queue<string>(new[] { "Dear Alexander,",  
     128        storyItem[0] = new StoryItem(new Queue<string>(new[] { "Dear Alexander,",  
    90129            "", 
    91130            "", 
     
    100139            "And perhaps then nothing could keep us apart.", 
    101140            "-Ana"  
    102         })); 
    103         //Pause(); 
    104     } 
    105  
    106     void ShowTextItem(Image image, Queue<string> messages) 
     141        }), LetterImage); 
     142 
     143        ShowTextItem(storyItem[0]); 
     144    } 
     145 
     146    void ShowTextItem(StoryItem item) 
    107147    { 
    108148        viewing = true; 
    109         messagesviewed = messages; 
     149        messagesviewed = new Queue<string>(item.Message); 
    110150        Pause(); 
    111151 
     
    118158        Add(frame); 
    119159 
    120         midpoint = 26 * messages.Count() * 0.5; 
     160        midpoint = 26 * item.Message.Count() * 0.5; 
    121161 
    122162    } 
  • 2015/27/ohjaajat/TheLegendOfGabriel/TheLegendOfGabriel/TheLegendOfGabrielContent/TheLegendOfGabrielContent.contentproj

    r6617 r6618  
    172172    </Compile> 
    173173  </ItemGroup> 
     174  <ItemGroup> 
     175    <Compile Include="frame.png"> 
     176      <Name>frame</Name> 
     177      <Importer>TextureImporter</Importer> 
     178      <Processor>TextureProcessor</Processor> 
     179    </Compile> 
     180  </ItemGroup> 
    174181  <Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\$(XnaFrameworkVersion)\Microsoft.Xna.GameStudio.ContentPipeline.targets" /> 
    175182  <!--  To modify your build process, add your task inside one of the targets below and uncomment it.  
Note: See TracChangeset for help on using the changeset viewer.