public void StartRemove()
 {
     foreach (var item in willRemove)
     {
         sourceObject.csvLines.Remove(item);
         Fungus.Command cmd = item.generatedCommand;
         if (cmd != null)
         {
             string msg = string.Format("Remove deleted cmd : {0} -> {1} -> {2} & {3}", cmd.gameObject.name, AdvUtility.FindParentBlock(cmd).BlockName, cmd.ItemId, item.keys);
             Debug.Log(msg);
             AdvUtility.FindParentBlock(cmd).CommandList.Remove(cmd);
             Object.DestroyImmediate(cmd, true);
         }
     }
     willRemove.Clear();
 }
    void UpdateData(string Result)
    {
        string sourceCSV = Result;

        Fungus.FlowchartExtend sourceObject = pageRef.prefab;

        sourceObject.GoogleSheetID = spreadsheetId;
        sourceObject.GooglePageID  = sheet_gid;
        List <AdvCSVLine> outdate    = AdvUtility.UpdateBlockByCSV(sourceObject, sourceCSV, option, true);
        List <AdvCSVLine> willRemove = outdate;

        UnityEditor.EditorUtility.SetDirty(sourceObject.gameObject);
        PrefabUtility.SavePrefabAsset(sourceObject.gameObject);

        if (willRemove == null)
        {
            return;
        }

        if (popupDetal)
        {
            AdvPrefabUpdateResult.OpenWindow(sourceObject, willRemove);
            return;
        }

        if (!autoRemove)
        {
            return;
        }

        foreach (var item in willRemove)
        {
            sourceObject.csvLines.Remove(item);
            Fungus.Command cmd = item.generatedCommand;
            if (cmd != null)
            {
                string msg = string.Format("Auto remove update lost cmd ... {0} -> {1} -> {2}&cmd{3}", cmd.gameObject.name, AdvUtility.FindParentBlock(cmd).BlockName, cmd.ItemId, item.keys);
                Debug.Log(msg);
                AdvUtility.FindParentBlock(cmd).CommandList.Remove(cmd);
                Object.DestroyImmediate(cmd);
            }
        }

        willRemove.Clear();
    }
Exemplo n.º 3
0
        protected virtual void CatchLocalizeText()
        {
            //Catch Localize Data when focus

            if (flowchart == null)
            {
                return;
            }
            MenuExtend t         = target as MenuExtend;
            string     textTerm  = $"{flowchart.GoogleSheetID}.{flowchart.GooglePageID}.{csvCommandKeyProp.stringValue}";
            string     localText = FungusExt.LocalizeManager.GetLocalizeText(textTerm);

            if (string.IsNullOrEmpty(localText))
            {
                string blockName = AdvUtility.FindParentBlock(flowchart, t).BlockName;
                Debug.LogError($"At : {t.gameObject.name} / {blockName} / {t.ItemId}");
            }
            textProp.stringValue = string.IsNullOrEmpty(localText) ? $"(key not found : {textTerm})" : localText;
            serializedObject.ApplyModifiedProperties();
        }
Exemplo n.º 4
0
        public void StartRemove()
        {
            if (willRemove == null)
            {
                return;
            }
            if (sourceObject == null)
            {
                return;
            }

            foreach (var item in willRemove)
            {
                sourceObject.csvLines.Remove(item);
                Command cmd = item.generatedCommand;
                if (cmd != null)
                {
                    AdvUtility.FindParentBlock(cmd).CommandList.Remove(cmd);
                    DestroyImmediate(cmd);
                }
                Block blk = item.generateBlock;
                if (blk != null)
                {
                    var commandList = blk.CommandList;
                    for (int j = 0; j < commandList.Count; ++j)
                    {
                        DestroyImmediate(commandList[j]);
                    }
                    if (blk._EventHandler != null)
                    {
                        DestroyImmediate(blk._EventHandler);
                    }
                    sourceObject.ClearSelectedCommands();

                    DestroyImmediate(blk);
                }
            }

            willRemove.Clear();
        }
Exemplo n.º 5
0
        public void ReoverCG()
        {
            if (sourceObject == null || targetObject == null)
            {
                return;
            }

            result = "";
            ControlCG []     srcComp       = sourceObject.GetComponents <ControlCG>();
            ControlCG []     tarComp       = targetObject.GetComponents <ControlCG>();
            List <ControlCG> remainTarList = new List <ControlCG>(tarComp);
            int index = 0;

            foreach (var item in srcComp)
            {
                if (item.Display == BackgroundDisplayType.HideAll || item.Display == BackgroundDisplayType.None)
                {
                    continue;
                }

                string CGName = item.SpriteCG ? item.SpriteCG.name : "(Null)";

                foreach (var target in tarComp)
                {
                    if (item.ItemId == target.ItemId)
                    {
                        target.SpriteCG = item.SpriteCG;
                        remainTarList.Remove(target);

                        result += string.Format("id:{0} / index:{1} : CG Name {2} apply \n", index, item.ItemId, CGName);
                    }
                }

                index++;
            }

            result += "\n";
            foreach (var item in remainTarList)
            {
                if (item.Display == BackgroundDisplayType.Show)
                {
                    result += string.Format("Not Update CG index:{0} , Block Name : {1} \n", item.ItemId, AdvUtility.FindParentBlock(item.GetComponent <FlowchartExtend>(), item).BlockName);
                }
            }

            UnityEditor.EditorUtility.SetDirty(targetObject);
            PrefabUtility.SavePrefabAsset(targetObject);
        }