Beispiel #1
0
        public Selection(Word p_StudyInfo, bool p_IsAnswer,Int32 p_Width,Int32 p_Height)
        {
            base.init();
            this.StudyInfo = p_StudyInfo;

            CCTexture2D texture = new CCTexture2D();
            texture.initWithTexture(PictureManager.GetTexture2D(p_StudyInfo));

            if (p_Width < texture.ContentSizeInPixels.width)
            {
                this.scaleX = p_Width / texture.ContentSizeInPixels.width;
            }
            if (p_Height < texture.ContentSizeInPixels.height)
            {
                this.scaleY = p_Height / texture.ContentSizeInPixels.height;
            }
            this.contentSize.width = p_Width;
            this.contentSize.height = p_Height;

            CCRect rect = new CCRect();
            rect.size = new CCSize(texture.ContentSizeInPixels.width, texture.ContentSizeInPixels.height);
            this.initWithTexture(texture, rect);

            this.IsAnswer = p_IsAnswer;
            LoadResultPeople();
        }
        public static CCTexture2D GetCCTexture2D(Word p_Word,Int32 p_Width,Int32 p_Height,bool p_Zoom)
        {
            CCTexture2D result = new CCTexture2D();
            result.initWithTexture(GetTexture2D(p_Word),new CCSize(p_Width,p_Height));

            return result;
        }
 public FloorLayer(Word p_Word)
 {
     base.init();
     m_Size = CCDirector.sharedDirector().getWinSize();
     this.isTouchEnabled = true;
     m_Word = p_Word;
     SayAction = new QuestionAction(m_Word);
 }
 public static Texture2D GetTexture2D(Word p_Word)
 {
     if (p_Word.IsContent)
     {
         return Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, Content.Current.ReadFile(p_Word.PictureFilePath));
     }
     else
     {
         return Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, Storage.Current.ReadFile(p_Word.PictureFilePath));
     }
 }
 public static void Play(Language p_Language, Word p_Word)
 {
     switch (p_Language)
     {
         case Language.Chinese:
             if (p_Word.HasChineseAudio)
             {
                 Play(p_Word.ChineseAudioFilePath);
             }
             else
             {
                 if (!NetworkManage.Current.IsConnection)
                 {
                     throw new MessageException("无网络");
                 }
                 TextToSpeech.Current.GetSound(
                     Language.Chinese.GetDescription(),
                     p_Word.ChineseName,
                     (obj) => {
                         Storage.Current.CreateFile(p_Word.ChineseAudioFilePath, Lib.Core.ByteBuffe.FromStream(obj).ToArrary());
                         MediaPlay.Current.Play(p_Word.ChineseAudioFilePath);
                     });
             }
             break;
         case Language.Enlish:
         default:
             if (p_Word.HasEnglishAudio)
             {
                 Play(p_Word.EnglishAudioFilePath);
             }
             else
             {
                 if (!NetworkManage.Current.IsConnection)
                 {
                     throw new MessageException("无网络");
                 }
                 TextToSpeech.Current.GetSound(
                      Language.Enlish.GetDescription(),
                      p_Word.EnglishName,
                      (obj) => {
                          Storage.Current.CreateFile(p_Word.EnglishAudioFilePath, Lib.Core.ByteBuffe.FromStream(obj).ToArrary());
                          MediaPlay.Current.Play(p_Word.EnglishAudioFilePath);
                      });
             }
             break;
     }
 }
 public static void Play(Language p_Language, Word p_Word)
 {
     switch (p_Language)
     {
         case Language.Chinese:
             if (p_Word.HasChineseAudio)
             {
                 p_Word.PlayChinese();
             }
             else
             {
                 if (!Lib.Network.NetworkManage.IsConnection)
                 {
                     throw new MessageException("无网络");
                 }
                 TextToSpeech.TextToSpeech down = new TextToSpeech.TextToSpeech();
                 down.GetSoud(Language.Chinese, p_Word);
             }
             break;
         case Language.Enlish:
         default:
             if (p_Word.HasEnglishAudio)
             {
                 p_Word.PlayEnglish();
             }
             else
             {
                 if (!Lib.Network.NetworkManage.IsConnection)
                 {
                     throw new MessageException("无网络");
                 }
                 TextToSpeech.TextToSpeech down = new TextToSpeech.TextToSpeech();
                 down.GetSoud(Language.Enlish, p_Word);
             }
             break;
     }
 }
 /// <summary>
 /// 添加
 /// </summary>
 /// <param name="p_Word"></param>
 /// <returns></returns>
 public static bool Insert(Word p_Word)
 {
     SQLiteCommand comm = myDB.CreateCommand(String.Format(SqlInsert, TableName,
         p_Word.ChineseName, p_Word.EnglishName,
         p_Word.PictureFile,Convert.ToInt32(p_Word.IsContent)));
     return comm.ExecuteNonQuery() > 0;
 }
 public AddWordLayer()
 {
     base.init ();
     m_Word = new Word ();
 }
 public QuestionAction(Word p_Word)
 {
     m_Word = p_Word;
 }
 public void GetSoud(Language p_Language,Word p_Word)
 {
 }
 public static Texture2D GetTexture2D(Word p_Word)
 {
     return Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice,FileLoader.ReadFile(p_Word.IsContent,p_Word.PictureFilePath));
 }
 public static Texture2D GetTexture2D(Word p_Word,Int32 p_Width,Int32 p_Height,bool p_Zoom)
 {
     return Texture2D.FromStream(CCApplication.sharedApplication().GraphicsDevice, FileLoader.ReadFile(p_Word.IsContent, p_Word.PictureFilePath), p_Width, p_Height, p_Zoom);
 }
 public static CCTexture2D GetCCTexture2D(Word p_Word, Int32 p_Width, Int32 p_Height, bool p_Zoom)
 {
     Texture2D text2D = GetTexture2D(p_Word,p_Width,p_Height,p_Zoom);
     CCTexture2D cctext2D = new CCTexture2D();
     cctext2D.initWithTexture(text2D);
     return cctext2D;
 }
 public static CCTexture2D GetCCTexture2D(Word p_Word)
 {
     CCTexture2D result = new CCTexture2D();
     result.initWithTexture(GetTexture2D(p_Word));
     return result;
 }