コード例 #1
0
ファイル: MNBookData.cs プロジェクト: gopa810/Rambha
        public void Load(RSFileReader br)
        {
            if (!br.ReadHeader(p_fileHeader))
            {
                return;
            }

            Clear();

            int  pageIndex = 0;
            byte b;

            while ((b = br.ReadByte()) != 0)
            {
                switch (b)
                {
                case 6:
                    p_id = br.ReadInt32();
                    break;

                case 10:
                    MNPage p = new MNPage(p_document);
                    p.Index = pageIndex;
                    p.Load(br);
                    p.ResetStatus();
                    Pages.Add(p);
                    pageIndex++;
                    break;

                case 11:
                    MNPage pt = new MNPage(p_document);
                    pt.Load(br);
                    Templates.Add(pt);
                    break;

                case 12:
                    MNReferencedText tx = new MNReferencedText();
                    tx.Load(br);
                    Scripts.Add(tx);
                    break;

                case 13:
                    MNMenu mn = new MNMenu();
                    mn.Load(p_document, br);
                    Menus.Add(mn);
                    break;
                }
            }
        }
コード例 #2
0
ファイル: PageView.cs プロジェクト: gopa810/Rambha
        /// <summary>
        /// Reloading language localizations for all controls
        /// </summary>
        public void ReloadPage(bool resetStatus)
        {
            if (CurrentDocument != null && p_current_page != null)
            {
                Context.messageBox.Visible = p_current_page.ShowMessageAlways;

                if (resetStatus)
                {
                    p_current_page.ResetStatus();
                }

                // reinitialize status
                if (p_current_page.InitialStatus == null)
                {
                    p_current_page.StoreStatus();
                }

                // load content for all controls
                foreach (SMControl control in p_current_page.Objects)
                {
                    if (control.ContentId != null && control.ContentId.Length > 0)
                    {
                        //Debugger.Log(0,"", "NEED LOAD CONTENT: " + control.ContentId + "\n");
                        MNReferencedCore value = FindContentObject(control.ContentType, control.ContentId);
                        control.Content = value;
                        if (value != null && value is MNReferencedAudioText)
                        {
                            p_current_runtext             = value as MNReferencedAudioText;
                            p_current_runtext.currentWord = 0;
                            timerRuntext.Interval         = p_current_runtext.GetCurrentTimeInterval();
                            timerRuntext.Start();
                            PlaySound(p_current_runtext.Sound);
                            Invalidate();
                        }
                        else if (value != null && value is MNReferencedSound)
                        {
                            PlaySound(value as MNReferencedSound);
                        }
                    }
                }
            }
        }