示例#1
0
        public void AddMod(string name, string sourceURL)
        {
            Mod    mod  = ModsManager.ModWithName(name);
            var    item = Mods.FirstOrDefault(i => i.Mod.Equals(mod));
            Source source;

            if (SourcesManager.TryBuildModSource(sourceURL, out source))
            {
                if (mod == null)
                {
                    mod = new Mod()
                    {
                        Name = name
                    };
                    item = new ModItemViewModel(mod, this);
                    AddModCommand.Execute(item);
                }
                SelectedMod  = item;
                mod.Language = source.Language;

                var srcItem = Mods.SelectMany(i => i.Sources).FirstOrDefault(s => s.Source.HasValidURL && s.Source.URL == sourceURL);
                if (srcItem == null)
                {
                    AddSourceCommand.Execute(new SourceItemViewModel(source, mod, this));
                }
                SelectedSource = srcItem;
            }
        }
示例#2
0
        private void SetInfo(FileObject fileObject)
        {
            playerGestureDatas.Clear();
            string json = ASCIIEncoding.UTF8.GetString(fileObject.Buffet);

            if (JsonCheckTool.IsJson(json))
            {
                playerGestureDatas = Newtonsoft.Json.JsonConvert.DeserializeObject <List <PlayerGestureData> >(json);
            }

            if (isOpenSetGesturePanel)
            {
                Canvas canvas = new GameObject("[SetCanvas]").AddComponent <Canvas>();
                GameObject.DontDestroyOnLoad(canvas.gameObject);
                canvas.renderMode = RenderMode.ScreenSpaceOverlay;
                canvas.gameObject.AddComponent <CanvasScaler>();
                canvas.gameObject.AddComponent <GraphicRaycaster>();
                canvas.sortingOrder = 100;
                if (!FindObjectOfType <EventSystem>())
                {
                    EventSystem eventSystem = new GameObject("EventSystem").AddComponent <EventSystem>();
                    eventSystem.gameObject.AddComponent <StandaloneInputModule>();
                }
                SourcesManager.LoadSources <SetGesturePanel>("SetGesturePanel", canvas.transform);
            }
        }
示例#3
0
 private Source(int id, string path, Server server, Language lang, string version) : base(id)
 {
     URL      = SourcesManager.BuildModSourceURL(server, path);
     Language = lang;
     Version  = new Version(version);
     Normalize();
 }
示例#4
0
        public void AddModSource(string sourceURL)
        {
            Source source;

            if (SourcesManager.TryBuildModSource(sourceURL, out source) && SelectedMod != null)
            {
                AddSourceCommand.Execute(new SourceItemViewModel(source, SelectedMod.Mod, this));
            }
        }
示例#5
0
        public void GetItems()
        {
            // Call to File Manager to get saved sources
            var sources = SourcesManager.GetSources();

            lock (_lock)
            {
                this.ClearItems();
                foreach (var source in sources)
                {
                    this.Add(source);
                }
            }
        }
示例#6
0
    /// <summary>
    /// 创建面板
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="windowTypeEnum"></param>
    /// <returns></returns>
    public static T CreatePanel <T>(Transform parent) where T : BasePanel
    {
        T t = default(T);

        T[] ts = Resources.LoadAll <T>("UIPanel");
        if (ts.Length > 0)
        {
            t = SourcesManager.LoadSources <T>(ts[0], parent);
        }
        else
        {
            Debug.Log("资源中不存在" + t.GetType().Name);
        }
        return(t);
    }
示例#7
0
        /// <summary>
        /// 设置面板
        /// </summary>
        /// <param name="_eventWindows"></param>
        public void SetPanel(EventWindows _eventWindows)
        {
            transform.localScale = Vector3.one;
            eventWindows         = _eventWindows;
            foreach (var item in PlayerManager.Instance.gestureEvents)
            {
                bool isF = false;
                for (int i = 0; i < eventWindows.events.Count; i++)
                {
                    if (eventWindows.events[i].playerGestureEventInfo.eventName == item.eventName && eventWindows.events[i].playerGestureEventInfo.eventDetailed == item.eventDetailed)
                    {
                        isF = true;
                        break;
                    }
                }
                if (isF)
                {
                    continue;
                }
                Event @event;
                if (_events.Count > 0)
                {
                    @event = _events[0];
                    @event.transform.parent     = Content;
                    @event.transform.localScale = Vector3.one;
                    _events.Remove(@event);
                }
                else
                {
                    @event = SourcesManager.LoadSources <Event>("Event", Content.transform);
                }
                @event.Init(item, eventWindows);
                @event.eventButton.OnClick.AddListener(() =>
                {
                    Detailed.transform.localScale = Vector3.one;
                    value.text             = @event.playerGestureEventInfo.eventDetailed;
                    playerGestureEventInfo = @event.playerGestureEventInfo;

                    ReturnEventButton(@event);
                });
                events.Add(@event);
            }
        }
示例#8
0
    /// <summary>
    /// 创建面板
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="windowTypeEnum"></param>
    /// <returns></returns>
    public static T CreatePanel <T>(WindowTypeEnum windowTypeEnum, UIPanelStateEnum panelStateEnum = UIPanelStateEnum.Open) where T : BasePanel
    {
        T t = default(T);

        t = GetPanel <T>(windowTypeEnum);
        if (t == null)
        {
            T[] ts = Resources.LoadAll <T>("UIPanel");
            if (ts.Length > 0)
            {
                t = SourcesManager.LoadSources <T>(ts[0], windowsDic[windowTypeEnum].transform);
                if (!PanelDic.ContainsKey(windowTypeEnum))
                {
                    PanelDic.Add(windowTypeEnum, new List <BasePanel> {
                        t
                    });
                }
                else
                {
                    PanelDic[windowTypeEnum].RemoveNull();
                    PanelDic[windowTypeEnum].Add(t);
                }
            }
            else
            {
                Debug.Log("资源中不存在" + t.GetType().Name);
            }
        }
        switch (panelStateEnum)
        {
        case UIPanelStateEnum.Open:
            t.Open();
            break;

        case UIPanelStateEnum.Hide:
            t.Hide();
            break;

        default:
            break;
        }
        return(t);
    }
示例#9
0
        //封装手势按钮天机方法,返回当前按钮
        private Gesture AddGesture(PlayerGestureData playerGesture)
        {
            Gesture gesture = SourcesManager.LoadSources <Gesture>("Gesture", Content);//在对象池中生成

            gestures.Add(gesture);
            gesture.Init(playerGesture, this);//初始化按钮
            gesture.gestureButton.OffChoice.AddListener(() =>
            {
                gestureWindows.Recovery();
                selectionWindow.Recovery();
                eventWindows.Recovery();
            });//添加按钮事件
            gesture.gestureButton.OnChoice.AddListener(() =>
            {
                gestureWindows.Recovery();
                eventWindows.Recovery();
                selectionWindow.SetPanel(gesture);
            });
            return(gesture);
        }
示例#10
0
        /// <summary>
        /// 封装的添加事件按钮
        /// </summary>
        /// <param name="_playerGestureEventInfo"></param>
        public void AddEvent(PlayerGestureEventInfo _playerGestureEventInfo)
        {
            PlayerGestureEventInfo playerGestureEventInfo = new PlayerGestureEventInfo();

            playerGestureEventInfo.eventDetailed = _playerGestureEventInfo.eventDetailed;
            playerGestureEventInfo.eventName     = _playerGestureEventInfo.eventName;
            playerGestureEventInfo.gestureName   = gesture.playerGestureData.playerGestureInfo.GestureName;
            //playerGestureEventInfo.isFindGesture = _playerGestureEventInfo.isFindGesture;
            playerGestureEventInfo.playerIndex = _playerGestureEventInfo.playerIndex;
            Event @event;

            if (_events.Count > 0)
            {
                @event = _events[0];
                @event.transform.parent     = Content;
                @event.transform.localScale = Vector3.one;
                _events.Remove(@event);
            }
            else
            {
                @event = SourcesManager.LoadSources <Event>("Event", Content);
            }
            @event.Init(playerGestureEventInfo, this);
            @event.eventButton.OffChoice.AddListener(() =>
            {
                eventInfoWindows.transform.localScale = Vector3.zero;
            });
            @event.eventButton.OnChoice.AddListener(() =>
            {
                eventInfoWindows.transform.localScale = Vector3.one;
                eventInfoWindows.SetPanel(@event, this);
            });
            events.Add(@event);
            PlayerGestureManager.Instance.ReturnGestureEvent(@event.playerGestureEventInfo);
            ReturnEventButton(@event);
            //for (int i = 0; i < events.Count; i++)
            //{

            //    Debug.Log(events[i].playerGestureEventInfo.playerIndex);
            //}
        }
示例#11
0
        private void Copy_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                var sources    = SourcesManager.GetSources();
                var archiveDir = Directory.Text;

                //var builder = new ContainerBuilder();
                //builder.RegisterType<FileManager>().As<IFileManager>();
                //builder.RegisterType<SettingsManager>().As<ISettingsManager>();
                //var container = builder.Build();
                //using (var scope = container.BeginLifetimeScope())
                //{
                var fm = App.DIScope.Resolve <IFileManager>();
                fm.InvokeBackup();
                //}
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.Message);
                Message.Text = ex.Message;
            }
        }
 //卸载完成
 private void AsyncUnload_completed(UnityEngine.AsyncOperation obj)
 {
     endUnload?.Invoke();
     GC.Collect();
     SourcesManager.UnloadUnusedAssets();
 }
示例#13
0
 public void SaveItems()
 {
     SourcesManager.SaveSources(this);
 }
示例#14
0
        static void Main(string[] args)
        {
            Console.WriteLine("ESILV - COURS D'ALGORITHMIQUE");
            Console.WriteLine("Exercices par Thomas LEDOS\n");
            // Ce programme détecte automatiquement quels semestres, TD et exercices existent et propose un menu pour les lancer

            PrintCompileOptions();

            string pattern = @"^S(?<s>\d+)_TD(?<td>\d+)$";

            List <Assembly> assemblies = new List <Assembly>();

            assemblies.Add(Assembly.GetExecutingAssembly());
            assemblies.AddRange(assemblies[0].GetReferencedAssemblies().Select(x => Assembly.Load(x)));

            string appFolder = new FileInfo(Assembly.GetEntryAssembly().Location).DirectoryName;

#if !NO_SOURCE
            SourcesManager.InitSources(appFolder);
#endif
#if !NO_COMPILER
            CompilerExercices exercicesCompiler = new CompilerExercices(appFolder);
            if (exercicesCompiler.CheckFiles())
            {
                Console.WriteLine("Compilation des fichiers locaux...");
                if (exercicesCompiler.Compile())
                {
                    Console.WriteLine("Compilation terminée avec succès.");
                }
                else
                {
                    Console.WriteLine("Impossible de compiler les fichiers locaux.");
                }
            }

            if (exercicesCompiler.HasAssemblies)
            {
                if (!exercicesCompiler.HasCompiled)
                {
                    Console.WriteLine("Chargement des fichiers locaux...");
                }
                exercicesCompiler.LoadAssemblies();
                Console.WriteLine("Fichiers locaux chargés.");
            }

            assemblies.AddRange(exercicesCompiler.LoadedAssemblies);
#endif

            SortedDictionary <int, KeyValuePair <Semestre, SortedDictionary <int, Type> > > semestres = new SortedDictionary <int, KeyValuePair <Semestre, SortedDictionary <int, Type> > >();

            foreach (Assembly assembly in assemblies)
            {
                foreach (Type type in assembly.GetExportedTypes())
                {
                    Match match = Regex.Match(type.Name, pattern);
                    if (match.Success)
                    {
                        int semestre = int.Parse(match.Groups["s"].Value);
                        int numeroTD = int.Parse(match.Groups["td"].Value);

                        if (!semestres.ContainsKey(semestre))
                        {
                            Semestre objectSemestre = new Semestre(semestre);
                            semestres.Add(semestre, new KeyValuePair <Semestre, SortedDictionary <int, Type> >(objectSemestre, new SortedDictionary <int, Type>()));
                        }

                        semestres[semestre].Value.Add(numeroTD, type);
                    }
                }
            }

            // semestres.OrderBy(pair => pair.Key).ToDictionary();

            bool continuer = true;
            while (continuer)
            {
                Console.WriteLine("\nListe des semestres disponibles :");

                foreach (KeyValuePair <int, KeyValuePair <Semestre, SortedDictionary <int, Type> > > semestre in semestres)
                {
                    int nombreTD = semestre.Value.Value.Count;
                    Console.WriteLine(" " + semestre.Key + ". " + semestre.Value.Key.Display() + " : " + nombreTD + " séance" + (nombreTD == 1 ? "" : "s") + " de TD");
                }

                Console.Write("\nEntre un numéro de semestre, 'c' pour voir le code source ou 'q' pour quitter : ");
                string semestreString = Console.ReadLine().ToLower();
                if (semestreString == "q")
                {
                    break;
                }
                if (semestreString == "c")
                {
                    Console.WriteLine("Ouverture du code source...");
                    Process.Start("https://github.com/th0m4s/algo_esilv");
                    continue;
                }

                string[] semestreParts = semestreString.Split('-', '_', '.', ',');

                int semestreId = 0;
                if (!int.TryParse(semestreParts[0], out semestreId))
                {
                    Console.WriteLine("Ce n'est pas un numéro de semestre...");
                    continue;
                }

                if (!semestres.ContainsKey(semestreId))
                {
                    Console.WriteLine("Ce semestre n'existe pas.\n");
                    continue;
                }

                int chosenTD = 0;
                KeyValuePair <Semestre, SortedDictionary <int, Type> > semestrePair = semestres[semestreId];

                if (semestreParts.Length != 2 || !int.TryParse(semestreParts[1], out chosenTD) || chosenTD <= 0)
                {
                    Console.WriteLine("\nListe des TD disponibles pour ce semestre (" + semestrePair.Key.Display() + ") :");

                    Console.WriteLine(string.Join(", ", semestrePair.Value.Keys.Select(x => "TD" + x)));

                    Console.Write("\nEntre un numéro de TD ou 0 pour annuler : ");
                    chosenTD = int.Parse(Console.ReadLine());
                }

                if (chosenTD > 0)
                {
                    if (semestrePair.Value.ContainsKey(chosenTD))
                    {
                        GestionTD gestionTD = semestrePair.Key.GetGestionTD(chosenTD, semestrePair.Value[chosenTD]);
                        continuer = gestionTD.MenuExercice();
                    }
                    else
                    {
                        Console.WriteLine("Ce TD n'existe pas pour le semestre demandé.\n");
                    }
                }
            }

            // Console.ReadKey();
        }
示例#15
0
        public List <ProductItem> GetTest(String parameter)
        {
            SourcesManager sm = new SourcesManager();

            return(sm.search(parameter));
        }