Changeset 6616 for 2015


Ignore:
Timestamp:
2015-06-30 16:14:20 (8 years ago)
Author:
empaheik
Message:

Tekstiesineiden näyttökalanruoto, odottaa evolvoitumista.

File:
1 edited

Legend:

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

    r6549 r6616  
    2020    List<Exit> exits = new List<Exit>(); 
    2121 
     22    private bool viewing; 
     23    private double midpoint; 
     24    private double second; 
     25    GameObject frame; 
     26    Queue<string> messagesviewed; 
     27 
    2228    #region Resources 
    2329 
    2430    public static Image GunImage = LoadImage("gun"); 
    25  
     31    public static Image LetterImage = LoadImage("letter"); 
    2632    public static Image SmallSwordImage = LoadImage("smallsword"); 
    2733 
     
    5157        LoadAnimations(); 
    5258        StartGame(); 
     59        Intro(); 
    5360    } 
    5461 
     
    6774            field.SetValue(this, assetAttr.Mirror ? MirrorAnimation(anim) : anim); 
    6875        } 
     76    } 
     77 
     78    void Intro() 
     79    { 
     80        ShowTextItem(LetterImage, new Queue<string>(new[] { "Dear Alexander,",  
     81            "", 
     82            "", 
     83            "I have accepted a position at the Communal Assets for Justice.", 
     84            "Please do not consider this an act of rejection. I am simply", 
     85            "a victim to the scathing uncertainty of your release from service.", 
     86            "", 
     87            "I still see your face in my dreams. I believe that when", 
     88            "our immediate circumstances change, we'll meet again, we'll", 
     89            "work it out. Were you here, we'd certainly fall in love.", 
     90            "", 
     91            "And perhaps then nothing could keep us apart.", 
     92            "-Ana"  
     93        })); 
     94        //Pause(); 
     95    } 
     96 
     97    void ShowTextItem(Image image, Queue<string> messages) 
     98    { 
     99        viewing = true; 
     100        messagesviewed = messages; 
     101        Pause(); 
     102 
     103        Level.AmbientLight -= 0.75; 
     104 
     105        frame = new GameObject(LetterImage); 
     106        frame.Image = LetterImage; 
     107        frame.Width = Window.Width * 0.25; 
     108        frame.Height = Window.Height * 0.25; 
     109        Add(frame); 
     110 
     111        midpoint = 26 * messages.Count() * 0.5; 
     112 
    69113    } 
    70114 
     
    218262        const double transitionSpeed = 500.0; 
    219263 
    220         if (transition) 
     264        if (transition && !viewing) 
    221265        { 
    222266            Camera.Position += Camera.Position.Normalize() * -transitionSpeed * dt; 
     
    237281            } 
    238282        } 
     283 
     284        if(viewing && !transition)  //!transition perhaps being somewhat unnecessary, but now I do feel a bit safer. 
     285        { 
     286            second += dt; 
     287            if(second > 1) 
     288            { 
     289                if (messagesviewed.Count < 1)   //The letter's read, we better head back. 
     290                { 
     291                    Level.AmbientLight = 1; 
     292                    frame.Destroy(); 
     293                    GetObjectsWithTag("labelWaitingToDie").ForEach(g => g.Destroy()); 
     294                    viewing = false; 
     295                    Pause(); 
     296                    return; 
     297                } 
     298 
     299                second = 0; 
     300                var storyLabel = new Label(messagesviewed.Dequeue()) { TextColor = Color.White }; 
     301                storyLabel.Y = -midpoint + storyLabel.Height * messagesviewed.Count() + 1; 
     302                storyLabel.Tag = "labelWaitingToDie"; 
     303                Add(storyLabel); 
     304 
     305            } 
     306            //Timer textTimer = new Timer(); 
     307            //textTimer.Interval = 1; 
     308            //textTimer.Timeout += delegate 
     309            //{ 
     310            //    if (messages.Count < 1) 
     311            //    { 
     312            //        Keyboard.EnableAll(); 
     313            //        Level.AmbientLight = 1; 
     314            //        frame.Destroy(); 
     315            //        GetObjectsWithTag("labelWaitingToDie").ForEach(g => g.Destroy()); 
     316            //        textTimer.Stop(); 
     317            //        Pause(); 
     318            //        return; 
     319            //    } 
     320 
     321            //    var storyLabel = new Label(messages.Dequeue()) { TextColor = Color.White }; 
     322            //    storyLabel.Y = -midpoint + storyLabel.Height * messages.Count() + 1; 
     323            //    storyLabel.Tag = "labelWaitingToDie"; 
     324            //    Add(storyLabel); 
     325            //}; 
     326            //textTimer.Start(); 
     327        } 
    239328    } 
    240329 
Note: See TracChangeset for help on using the changeset viewer.