Example #1
0
 private static void Init()
 {
     if (instance == null)
     {
         instance = OtherUtils.CreateMonoBehaviourBase <TimerManager>();
     }
 }
Example #2
0
    static void OnPostprocessAllAssets(string[] importedAssets, string[] deletedAssets, string[] movedAssets, string[] movedFromAssetPaths)
    {
        string[]      _strSplit;
        string        _fileName;
        List <string> _jsonList = new List <string> ();

        for (int _idx = 0; _idx < importedAssets.Length; _idx++)
        {
            string _importedAsset = importedAssets[_idx];
            if (
                OtherUtils.isAContainsB(_importedAsset, jsonExportFromFlashPath) &&
                OtherUtils.isAContainsB(_importedAsset, ".json")
                )
            {
                _strSplit = System.Text.RegularExpressions.Regex.Split(_importedAsset, jsonExportFromFlashPath);
                _fileName = _strSplit[1];
                _jsonList.Add(_fileName);
            }
        }
//        for (int i = 0; i < deletedAssets.Length; i++) {
//            Debug.Log ("Deleted Asset: " + deletedAssets[i]);
//        }
//        for (int i = 0; i < movedAssets.Length; i++) {
//            Debug.Log ("Moved Asset: " + movedAssets[i] + " from: " + movedFromAssetPaths[i]);
//        }
    }
Example #3
0
        public override object InformationToProperty(IInformation information, Type propertyType)
        {
            var value = information as IInformationValue;
            if (value == null)
            {
                throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, $"'{information.Name}' must be a value type.");
            }

            try
            {
                // Change .md or .markdown extensions to .html and change macros to an XML form.
                var menuString =
                    MarkdownProcessor.Transform(
                        ParsingUtils.ReplaceMacros(
                            Regex.Replace(
                                OtherUtils.ReadAllText(value.Value),
                                @"\w+?\.(?:md|markdown)",
                                match => PathUtils.ChangeExtension(match.Value, "html"))));
                return XmlUtils.WrapAndParse("Menu", menuString);
            }
            catch (Exception e)
            {
                throw new OptionReaderException(information.Lines.First().Number, information.Lines.Last().Number, e.Message);
            }
        }
Example #4
0
 private static void Init()
 {
     if (instance == null)
     {
         instance = OtherUtils.CreateMonoBehaviourBase <Stopwatch>();
     }
 }
        public static IEnumerator LoadAssetsIEnumerator(string path, CallBack <AssetData[]> callBack)
        {
            if (assetBundleManifest == null)
            {
                LoadAssetBundleManifest();
            }
            AssetData[] rds = null;
            if (!assetCacheDic.ContainsKey(path))
            {
                string[] depArr = GetAllDependenciesName(Path.GetFileNameWithoutExtension(path));
                for (int i = 0; i < depArr.Length; i++)
                {
                    string p = ResourcePathManager.GetPath(depArr[i]);
                    if (!assetCacheDic.ContainsKey(p))
                    {
                        yield return(LoadAssetsIEnumerator(p, null));
                    }
                }
                string temp = OtherUtils.GetWWWLoadPath(path);

                //加载bundle文件
                WWW www = new WWW(temp);
                yield return(www);

                if (string.IsNullOrEmpty(www.error))
                {
                    try
                    {
                        AssetBundle ab = www.assetBundle;
                        rds = DealWithAssetBundle(ab);
                        //Debug.Log("加载成功:" + path);
                        assetBundleCacheDic.Add(path, ab);
                        assetCacheDic.Add(path, rds);
                        www.Dispose();
                    }
                    catch (Exception e)
                    {
                        Debug.LogError("Path:" + path + "\r\n" + e);
                    }
                }
                else
                {
                    Debug.LogError("加载失败,Path:" + path + "  error:" + www.error);
                }
            }
            else
            {
                rds = assetCacheDic[path];
            }
            yield return(new WaitForEndOfFrame());

            if (rds == null)
            {
                rds = new AssetData[0];
            }
            if (callBack != null)
            {
                callBack(rds);
            }
        }
Example #6
0
        public void Publish(ReportSeverity reportSeverity)
        {
            // If we need a new line then add it.
            OtherUtils.ConsoleGotoNewLine();

            // Give errors or warnings in standard form.
            var ttb = new TitledTextBuilder();

            ttb.Append(_reportTitles[reportSeverity], _genreDescriptions[this.ReportGenre]);

            // If given, write reason.
            if (!this.Reason.IsNullOrEmpty())
            {
                ttb.Append("Reason", this.Reason);
            }

            // If given, write location.
            if (!this.Location.IsNullOrEmpty())
            {
                ttb.Append("Location", this.Location);
            }

            if (reportSeverity == ReportSeverity.Error)
            {
                Console.Error.WriteLine($"\n{ttb}");
            }
            else
            {
                Console.Write($"\n{ttb}");
            }
        }
Example #7
0
        public void Run(RemoteHooking.IContext inContext, string inChannelName, string[] dllsToLoad)
        {
            try
            {
                Stopwatch stopwatch = Stopwatch.StartNew();
                Interface.Log($"== {OtherUtils.GetAssemblyProductName()} v{OtherUtils.GetAssemblyVersion()} ==");
                Interface.Log($"Using {OtherUtils.ApiProductName} v{OtherUtils.ApiVersion}");

                GlobalHooks.InitGlobalHooks(Interface);

                Loader = new Loader(Interface);
                Loader.LoadMods(dllsToLoad);

                // Make sure the game is fully loaded
                while (Marshal.ReadByte((IntPtr)0x500380) < 9)
                {
                }

                Loader.InitMods();

                stopwatch.Stop();
                Interface.Log($"Done. ({stopwatch.Elapsed.TotalSeconds:F3}s)");

                RemoteHooking.WakeUpProcess();

                while (true)
                {
                    Thread.Sleep(1000);
                }
            }
            catch (Exception e)
            {
                Interface.HandleError(e);
            }
        }
Example #8
0
 protected override void OnMessage(MessageEventArgs e)
 {
     try
     {
         if (e.IsText)
         {
             var msg = JsonConvert.DeserializeObject <BaseMessage>(e.Data);
             _app.Router.RouteMessage(_app.SessionManager.GetSession(ID), msg);
         }
         else
         {
             var errMsg = OtherUtils.GenerateProtocolError(
                 null,
                 "parseError",
                 $"Server cannot parse this message because it is not JSON",
                 new Dictionary <string, object>()
                 );
             errMsg.From = _app.Config.ServerID;
             var msgStr = JsonConvert.SerializeObject(errMsg);
             this.SendMessage(msgStr);
         }
     }
     catch (Exception ex)
     {
         var errMsg = OtherUtils.GenerateProtocolError(
             null,
             "parseError",
             $"Server cannot parse this message! {ex.Message}",
             new Dictionary <string, object>()
             );
         errMsg.From = _app.Config.ServerID;
         var msgStr = JsonConvert.SerializeObject(errMsg);
         this.SendMessage(msgStr);
     }
 }
Example #9
0
        private static void GetOptions(string path, Options options)
        {
            var parserExceptions  = new ListenerAndAggregater <OptionReaderException>();
            var projectFileReader = new OptionsReader <Options>(5, "Project file")
            {
                ErrorListener = parserExceptions
            };
            var projFileSource = OtherUtils.ReadAllText(path);

            PathUtils.RunInDirectory(
                Path.GetDirectoryName(path),
                () => projectFileReader.Parse(options, path, projFileSource));
            var ws = parserExceptions.Warnings;
            var es = parserExceptions.Errors;

            // Report any errors to the user.
            Action <ConsolePublisher, OptionReaderException> action
                = (p, e) => p.DescriptionReasonLocation(ReportGenre.ProjectFile, e.Message, StringUtils.LocationString(e.StartLine, e.EndLine, Path.GetFullPath(path)));

            if (ws.Any())
            {
                Report.Warnings(action, ws);
            }

            if (es.Any())
            {
                Report.Errors(action, es);
            }
        }
Example #10
0
        public static Project ParseProject(IEnumerable <string> sourceFiles, bool runInSerial)
        {
            var files        = runInSerial ? sourceFiles : sourceFiles.AsParallel();
            var languageList = new List <ILanguageParser>();

            var parsedFiles = files.Select(path =>
            {
                Report.Message("Parsing", path);

                // Parse source files.
                ILanguageParser language;
                try
                {
                    language = ParserManager.GetParserByExtension(Path.GetExtension(path));
                }
                catch (NotSupportedException e)
                {
                    Report.Error(p => p.DescriptionReasonLocation(ReportGenre.FileRead, e.Message, path), e);
                    return(null);
                }

                languageList.AddIf(p => languageList.Select(p2 => p2.Identifier).All(i => i != p.Identifier), language);
                var source = OtherUtils.ReadAllText(path);
                return(language.Parse(path, source));
            })
                              .ToList();

            var project = new Project(parsedFiles);

            new Traverser("Global post processing", languageList.SelectMany(p => p.GlobalTraverserActions).ToArray()).Go(project);
            return(project);
        }
Example #11
0
        static public void LoadNeutral()
        {
            RisiaAddFacts = new List <BlueprintFeature>();

            compNeutral                = Helpers.Create <AddClassLevels>();
            compNeutral.Archetypes     = new BlueprintArchetype[] { };
            compNeutral.CharacterClass = arcanist;
            compNeutral.Levels         = 7;
            compNeutral.LevelsStat     = StatType.Intelligence;
            compNeutral.Skills         = new StatType[] {
                StatType.SkillKnowledgeArcana,
                StatType.SkillKnowledgeWorld,
                StatType.SkillPersuasion,
                StatType.SkillStealth,
                StatType.SkillPerception,
                StatType.SkillUseMagicDevice,
                StatType.SkillMobility
            };
            compNeutral.SelectSpells   = RisiaSpellKnownLevelupSelect;
            compNeutral.MemorizeSpells = RisiaSpellMemory;

            BlueprintFeatureSelection    basicFeatSelection = getSelection("247a4068296e8be42890143f451b4b45");
            BlueprintParametrizedFeature spellFocus         = getFeat("16fa59cc9a72a6043b566b49184f53fe") as BlueprintParametrizedFeature;

            List <SelectionEntry> selectionEntryList = new List <SelectionEntry>();

            selectionEntryList.Add(new SelectionEntry {
                Selection = basicFeatSelection,//basic feat selection
                Features  = RisiaFeats
            });
            selectionEntryList.Add(new SelectionEntry {
                Selection             = getSelection("247a4068296e8be42890143f451b4b45"),
                IsParametrizedFeature = true,
                ParametrizedFeature   = spellFocus,
                ParamSpellSchool      = SpellSchool.Illusion
            });
            selectionEntryList.Add(new SelectionEntry {
                Selection             = getSelection("247a4068296e8be42890143f451b4b45"),
                IsParametrizedFeature = true,
                ParametrizedFeature   = spellFocus,
                ParamSpellSchool      = SpellSchool.Enchantment
            });
            selectionEntryList.Add(new SelectionEntry {
                Selection = ArcaneExploits.exploitSelection,
                Features  = RisiaArcaneExploits
            });
            compNeutral.Selections = selectionEntryList.ToArray();
            learnNeutral           = Helpers.Create <LearnSpells>(a => {
                a.Spells         = RisiaSpellKnownAfterwards;
                a.CharacterClass = ArcanistClass.arcanist;
            });
            var RisiaLearnSpellFeat = Helpers.CreateFeature("RisiaLearnSpellFeat", "", "",
                                                            OtherUtils.GetMd5("Risia.LearnSpellFeat"),
                                                            null,
                                                            FeatureGroup.None,
                                                            learnNeutral);

            RisiaAddFacts.Add(RisiaLearnSpellFeat);
        }
Example #12
0
 public void InitMods()
 {
     Interface.Log("Initializing mods...");
     foreach (IMod mod in Mods)
     {
         Interface.Log($"{mod.GetType().Assembly.GetName().Name} v{OtherUtils.GetVersionString(mod.GetType().Assembly)}", LogType.Debug);
         mod.Run(Interface);
     }
 }
Example #13
0
 // Use this for initialization
 static public void StartUpdating(MonoBehaviour mono, string serverPath, CallBack completCalback)
 {
     platform = OtherUtils.GetPlatformFolder(Application.platform);
     PathDir  = Application.persistentDataPath + "/" + platform;
     UpdateResourseController.serverPath = serverPath;
     Debug.Log("PathDir: " + PathDir);
     showContentCallBack("Check for updates");
     mono.StartCoroutine(Updating(completCalback));
 }
Example #14
0
    /// <summary>
    /// 申请添加好友
    /// </summary>
    public void onApplyAddFriend(ApplyAddFriendData data)
    {
        //快捷方式
        OtherUtils.putObjInDicWithMax(data.playerID, data, _d.applyDic, Global.applyAddFriendMaxNum, compareApplyAddFriend);

        me.dispatch(GameEventType.ReceiveApplyFriend, data.playerID);
        me.dispatch(GameEventType.RefreshApplyFriendList);
        onApplyAddFriendForG(data);
    }
Example #15
0
 public AccountCreation(IWebDriver driver, ScenarioContext context)
 {
     this.driver  = driver;
     this.context = context;
     PageFactory.InitElements(driver, this);
     wait      = new WebDriverWait(driver, new TimeSpan(0, 0, 10));
     utilspage = new OtherUtils(driver);
     log       = context.Get <ILog>("log");
     test      = context.Get <ExtentTest>("extentTest");
 }
Example #16
0
        public static void NewStatus(string message)
        {
            if (Verbose < 2)
            {
                return;
            }

            OtherUtils.ConsoleGotoNewLine();
            Console.Write(message);
        }
Example #17
0
 public static int getFrameIntByString(MCTimeLineInfo _mcTimeLineInfoStruct, string str_)
 {
     if (OtherUtils.isInt(str_))
     {
         return(OtherUtils.toInt(str_));
     }
     else
     {
         return(getFrameIntByFrameName(_mcTimeLineInfoStruct, str_));
     }
 }
Example #18
0
        static private BuffConsideration considerNoBuff(string name, BlueprintBuff[] buffs, float hasBuff = 0f, float noBuff = 1f)
        {
            var ans = Helpers.Create <BuffConsideration>();

            ans.BaseScoreModifier = 1.0f;
            ans.HasBuffScore      = hasBuff;
            ans.NoBuffScore       = noBuff;
            ans.Buffs             = buffs;
            library.AddAsset(ans, OtherUtils.GetMd5(name));
            return(ans);
        }
Example #19
0
        public static void Message(string title, string text)
        {
            if (Verbose < 3)
            {
                return;
            }

            var ttb = new TitledTextBuilder();

            ttb.Append(title, text);
            OtherUtils.ConsoleGotoNewLine();
            Console.Write(ttb.ToString());
        }
Example #20
0
        static private BuffsAroundConsideration considerBuffsAround(string name, TargetType filter, BlueprintBuff[] buffs, int maxCount = 4, float maxScore = 1f, int minCount = 1, float minScore = 0f)
        {
            var ans = Helpers.Create <BuffsAroundConsideration>();

            ans.Buffs         = buffs;
            ans.Filter        = filter;
            ans.MaxCount      = maxCount;
            ans.MaxScore      = maxScore;
            ans.MinCount      = minCount;
            ans.MinScore      = minScore;
            ans.BelowMinScore = minScore;
            library.AddAsset(ans, OtherUtils.GetMd5(name));
            return(ans);
        }
Example #21
0
    /** 添加申请 */
    public void onAddApply(PlayerApplyRoleGroupData data)
    {
        //放入邀请组
        OtherUtils.putObjInDicWithMax(data.data.showData.playerID, data, _d.applyDic, _config.applyKeepMax, _applyComparator);

        evt.groupID   = groupID;
        evt.targetID  = data.data.showData.playerID;
        evt.applyData = data;
        me.dispatch(GameEventType.RoleGroupReceiveApply, evt);

        evt.groupID   = groupID;
        evt.targetID  = data.data.showData.playerID;
        evt.applyData = data;
        me.dispatch(GameEventType.RoleGroupApplyChange, evt);
    }
Example #22
0
        static internal void FixPrestigeSpellbookSelection(string prestigeSpellbookSelectionId, string prestigeSpellbookSelectionWizardItemId, FeatureGroup group)
        {
            BlueprintFeatureSelection spellbookSelection = library.Get <BlueprintFeatureSelection>(prestigeSpellbookSelectionId);

            if (spellbookSelection == null)
            {
                string errorMsg = $"Error, Prestige Spellbook Selection {prestigeSpellbookSelectionId} not exist!";
                logger.Error(errorMsg);
                throw new Exception(errorMsg);
            }

            var wizardFeature = spellbookSelection.AllFeatures.Cast <BlueprintFeatureReplaceSpellbook>()
                                .First(f => f.AssetGuid == prestigeSpellbookSelectionWizardItemId);

            // Create a new feature for this archetype's spellbook
            string arcanistFeatureName = $"ArcanistClass{group.ToString()}ChosenItem";
            var    arcanistFeature     = library.CopyAndAdd <BlueprintFeatureReplaceSpellbook>(
                wizardFeature, arcanistFeatureName, OtherUtils.GetMd5(arcanistFeatureName));

            arcanistFeature.Spellbook = arcanist.Spellbook;
            arcanistFeature.SetName(arcanist.Name);

            var classSpellPreqComp = wizardFeature.GetComponent <PrerequisiteClassSpellLevel>();

            if (classSpellPreqComp == null)
            {
                classSpellPreqComp = Helpers.Create <PrerequisiteClassSpellLevel>(a => {
                    a.CharacterClass     = arcanist;
                    a.RequiredSpellLevel = 1;
                });
            }
            else
            {
                classSpellPreqComp = UnityEngine.Object.Instantiate(classSpellPreqComp);
                classSpellPreqComp.CharacterClass = arcanist;
            }
            // Update the prerequisites.
            arcanistFeature.SetComponents(new BlueprintComponent[] { classSpellPreqComp });

            // Add to the list of all features for this selector.
            var allFeatures = spellbookSelection.AllFeatures.ToList();

            allFeatures.Add(arcanistFeature);
            spellbookSelection.AllFeatures = allFeatures.ToArray();
        }
Example #23
0
    void OnPreprocessTexture()
    {
        string _dirName = System.IO.Path.GetDirectoryName(assetPath);

        if (OtherUtils.isAContainsB(_dirName, pngExportFromFlashPath))
        {
            string[] _strSplit        = System.Text.RegularExpressions.Regex.Split(_dirName, pngExportFromFlashPath);
            string   _altasFolderName = _strSplit[1];
            string   _altasName       = _altasFolderName + ".spriteatlas";
            string   _altasPath       = _dirName + "/" + _altasName;
            if (!File.Exists(_altasPath))    //Check atlas.
            {
                createSpriteAltas(pngExportFromFlashPath + _altasFolderName, _altasName);
            }
            TextureImporter textureImporter = (TextureImporter)assetImporter;
            textureImporter.textureType = TextureImporterType.Sprite;
        }
    }
        public void HandleMessage(Session session, BaseMessage message)
        {
            var pObj         = message.Payload.ToObject <RegisterRequestPayload>();
            var authProvider = _pluginHost.GetAuthProvider();

            try
            {
                authProvider.CreateUser(pObj.Username, pObj.Password);
            }
            catch (Exception e)
            {
                BaseMessage errorReply;
                if (e.Message.Contains("E11000"))
                {
                    errorReply = OtherUtils.GenerateProtocolError(
                        message,
                        "id_exists",
                        "Username already taken",
                        new Dictionary <string, object>()
                        );
                }
                else
                {
                    errorReply = OtherUtils.GenerateProtocolError(
                        message,
                        "other",
                        e.ToString(),
                        new Dictionary <string, object>()
                        );
                }

                session.ConnectionHandler.SendMessage(errorReply);
                return;
            }

            BaseMessage reply = new BaseMessage(message, true);
            var         p     = new RegisterResponsePayload();

            p.UserID = $"@{pObj.Username}@{_pluginHost.GetServerID()}";

            reply.Payload = p.ToDictionary();
            reply.Ok      = true;
            session.ConnectionHandler.SendMessage(reply);
        }
Example #25
0
        public void RouteMessage(Session session, BaseMessage message)
        {
            var handlers = _c2sMessageHandlers.GetValueOrDefault(message.MessageType, null);

            if (handlers == null)
            {
                Log.Warning($"Drop message with type \"{message.MessageType}\" because server hasn't proper handlers");
                var msg = OtherUtils.GenerateProtocolError(
                    message,
                    "unhandled",
                    $"Server doesn't implement message type \"{message.MessageType}\"",
                    new Dictionary <string, object>()
                    );
                msg.From = _app.Config.ServerID;
                session.ConnectionHandler.SendMessage(msg);
                return;
            }
            var handlerTasks = new List <Task>();

            foreach (var h in handlers)
            {
                if (h.IsAuthorizationRequired() && session.AuthData == null)
                {
                    session.ConnectionHandler.SendMessage(OtherUtils.GenerateUnauthorizedError(message, _app.Config.ServerID));
                    return;
                }

                handlerTasks.Add(Task.Run(() =>
                {
                    // probably need to wrap whole foreach body, not only HandleMessage call - need to investigate
                    h.HandleMessage(session, message);
                }));
            }
            try
            {
                Task.WaitAll(handlerTasks.ToArray());
            }
            catch (Exception e)
            {
                Log.Error(e.ToString());
            }
        }
        static private void CreateDispelAura()
        {
            if (dispelHoly != null || dispelUnholy != null)
            {
                return;
            }
            BlueprintAbility greaterDMArea  = library.Get <BlueprintAbility>("b9be852b03568064b8d2275a6cf9e2de");
            BlueprintBuff    holyAuraBuff   = library.Get <BlueprintBuff>("a33bf327207a5904d9e38d6a80eb09e2");
            BlueprintBuff    unholyAuraBuff = library.Get <BlueprintBuff>("9eda82a1f78558747a03c17e0e9a1a68");

            dispelHoly = library.CopyAndAdd <BlueprintAbility>(
                greaterDMArea,
                "RisiaDispelAreaHolyAura",
                OtherUtils.GetMd5("Risia.DispelMagicArea.HolyAura")
                );
            dispelUnholy = library.CopyAndAdd <BlueprintAbility>(
                greaterDMArea,
                "RisiaDispelAreaUnholyAura",
                OtherUtils.GetMd5("Risia.DispelMagicArea.UnholyAura")
                );
            dispelHoly.Parent   = null;
            dispelUnholy.Parent = null;
            var compRunActionDMArea = greaterDMArea.GetComponent <AbilityEffectRunAction>();

            dispelHoly.RemoveComponent(compRunActionDMArea);
            dispelHoly.RemoveComponent(compRunActionDMArea);

            var compRunActionDMHoly   = UnityEngine.Object.Instantiate <AbilityEffectRunAction>(compRunActionDMArea);
            var compRunActionDMUnholy = UnityEngine.Object.Instantiate <AbilityEffectRunAction>(compRunActionDMArea);

            compRunActionDMHoly.Actions = new ActionList {
                Actions = new GameAction[] {
                    Helpers.Create <ContextActionDispelCertainMagic>(a => a.buffBlue = holyAuraBuff)
                }
            };
            compRunActionDMUnholy.Actions = new ActionList {
                Actions = new GameAction[] {
                    Helpers.Create <ContextActionDispelCertainMagic>(a => a.buffBlue = unholyAuraBuff)
                }
            };
        }
Example #27
0
    /// <summary>
    /// 从库中读完数据后(做数据的补充解析)(onNewCreate后也会调用一次)(主线程)
    /// </summary>
    public override void afterReadData()
    {
        ActivityData sData;

        ActivityConfig[] values;
        ActivityConfig   v;

        for (int i = (values = ActivityConfig.getDic().getValues()).Length - 1; i >= 0; --i)
        {
            if ((v = values[i]) != null)
            {
                if (checkEnable(v))
                {
                    sData = _d.datas.get(v.id);

                    //补充
                    if (sData == null)
                    {
                        sData               = new ActivityData();
                        sData.id            = v.id;
                        sData.nextResetTime = 0;
                        sData.lastTurnTime  = 0;
                        sData.nextTurnTime  = 0;
                        sData.joinTimes     = 0;

                        _d.datas.put(sData.id, sData);
                    }

                    sData.config = v;
                }
                else
                {
                    //直接移除
                    _d.datas.remove(v.id);
                }
            }
        }

        //fixed
        OtherUtils.removeNotExistFromDic1WithDic2(_d.datas, ActivityConfig.getDic());
    }
Example #28
0
    /// <summary>
    /// 绘制文件目录GUI
    /// </summary>
    /// <param name="control">文件信息</param>
    /// <param name="direType">显示文件夹或全部目录</param>
    /// <param name="selectCallback">选择一个文件回调</param>
    /// <param name="isShowChoose">是否打开勾选文件</param>
    /// <param name="chooseCallBack">勾选文件回调</param>
    public static void DrawFileDirectory(TreeModelController <FileData> control, ShowFileDirectoryType direType = ShowFileDirectoryType.ShowAllFile, string[] showEndsWith = null, CallBack <FileData> selectCallback = null, bool isShowChoose = false, CallBack <FileData> chooseCallBack = null)
    {
        GUI.enabled = true;
        EditorGUIUtility.SetIconSize(Vector2.one * 16);
        control.TreeForeachNode((data) =>
        {
            if (direType == ShowFileDirectoryType.OnlyDirectory)
            {
                if (data.isDirectory)
                {
                    DrawGUIData(control, data, direType, selectCallback, isShowChoose, chooseCallBack);
                    if (!data.isSelected)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (data.isDirectory && !data.isSelected)
                {
                    DrawGUIData(control, data, direType, selectCallback, isShowChoose, chooseCallBack);
                    return(false);
                }
                if (showEndsWith != null)
                {
                    if (!data.isDirectory)
                    {
                        if (OtherUtils.ArrayContains(showEndsWith, Path.GetExtension(data.relativeRootPath)))
                        {
                            DrawGUIData(control, data, direType, selectCallback, isShowChoose, chooseCallBack);
                        }
                        return(true);
                    }
                }

                DrawGUIData(control, data, direType, selectCallback, isShowChoose, chooseCallBack);
            }
            return(true);
        });
    }
        private static Trigger ParseToTrigger(string value, SourcePosition pos)
        {
            if (string.IsNullOrWhiteSpace(value))
            {
                return(Trigger.Undefined);
            }
            var cat = value.Substring(0, value.IndexOf(':'));

            if (string.IsNullOrWhiteSpace(cat))
            {
                return(Trigger.Undefined);
            }
            var id = value.Substring(value.IndexOf(':') + 1);

            if (string.IsNullOrWhiteSpace(id))
            {
                return(Trigger.Undefined);
            }
            return(new Trigger((TriggerCategory)OtherUtils.IntParse(cat),
                               OtherUtils.IntParse(id), pos));
        }
Example #30
0
    public static MovieClip getMovieClipByTimeLine(MCTimeLineInfo _mcTimeLineInfo)
    {
        MovieClip _movieClip;

        if (_mcTimeLineInfo.MovieClipCache == null)   //Every timeline info
        {
            Type type = Type.GetType(_mcTimeLineInfo.className);
            if (type != null)   //cache a DIY class instance.
            {
                _movieClip = OtherUtils.getComponent(type) as MovieClip;
                _movieClip.gameObject.name     = "cache_" + _mcTimeLineInfo.className;
                _movieClip.selfTrans.parent    = _cacheContainerTransform;
                _mcTimeLineInfo.MovieClipCache = _movieClip;
            }
            else     //use normal cache MovieClip.
            {
                _mcTimeLineInfo.MovieClipCache = _movieClipCache;
            }
        }
        _movieClip = GameObject.Instantiate(_mcTimeLineInfo.MovieClipCache);
        return(_movieClip);
    }