コード例 #1
0
    void addVal(string key, string val, bool isForce = false)
    {
        if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(val))
        {
            if (dictOrgs.ContainsKey(key) && !isForce)
            {
                EditorUtility.DisplayDialog("error", "The key is allready exist!", "Okay");
            }
            else
            {
                string fileName = Application.dataPath + "/" + CLPathCfg.self.localizationPath + "Chinese.txt";
                fileName = fileName.Replace("/upgradeRes/", "/upgradeRes4Dev/");
                if (isForce)
                {
                    Dictionary <string, string> tempDic = null;
                    byte[]     buff   = File.ReadAllBytes(fileName);
                    ByteReader reader = new ByteReader(buff);
                    tempDic       = reader.ReadDictionary();
                    tempDic [key] = val;

                    PStr pstr = PStr.b();
                    foreach (KeyValuePair <string, string> cell in tempDic)
                    {
                        pstr.a(cell.Key).a("=").a(cell.Value.Replace("\n", "\\n")).a("\n");
                    }
                    File.WriteAllText(fileName, pstr.e());
                }
                else
                {
                    File.AppendAllText(fileName, "\n" + key + "=" + val);
                }
                refreshContent();
            }
        }
    }
コード例 #2
0
    void cutVal(string key)
    {
        string fileName = Application.dataPath + "/" + CLPathCfg.self.localizationPath + "Chinese.txt";

        fileName = fileName.Replace("/upgradeRes/", "/upgradeRes4Dev/");
        Dictionary <string, string> tempDic = null;

        byte[]     buff   = File.ReadAllBytes(fileName);
        ByteReader reader = new ByteReader(buff);

        tempDic = reader.ReadDictionary();
        if (!tempDic.ContainsKey(key))
        {
            return;
        }
        tempDic.Remove(key);

        PStr pstr = PStr.b();

        foreach (KeyValuePair <string, string> cell in tempDic)
        {
            pstr.a(cell.Key).a("=").a(cell.Value.Replace("\n", "\\n")).a("\n");
        }
        File.WriteAllText(fileName, pstr.e());
        refreshContent();
    }
コード例 #3
0
ファイル: ECLCurve2Code.cs プロジェクト: coolape/mibao
    string getCodeLua()
    {
        PStr p = PStr.b().a("local curve = AnimationCurve ();\n");

        if (curve == null)
        {
            return("");
        }
        Keyframe kf = new Keyframe();

        for (int i = 0; i < curve.length; i++)
        {
            kf = curve [i];
            p.a("curve:AddKey(Keyframe(").a(kf.time).a(", ").a(kf.value).a(", ").a(kf.inTangent).a(", ").a(kf.outTangent).a("));\n");
        }
        return(p.e());
    }
コード例 #4
0
    public static void exportEventCfg(List <Node> nodes)
    {
        ArrayList list = new ArrayList();
        ArrayList cell = new ArrayList();
        Node      node = null;
        PStr      pstr = PStr.b();

        for (int i = 0; i < nodes.Count; i++)
        {
            node = nodes [i];
            if (node is Root)
            {
                continue;
            }
            pstr.a(node.index);
            pstr.a("\t");
            if (node.behaviorTree.rootNode.attr != null)
            {
                pstr.a(((MyRoot)(node.behaviorTree.rootNode.attr)).fubenID);
            }
            else
            {
                pstr.a(0);
            }
            pstr.a("\t");
            pstr.a(node.condition);
            pstr.a("\t");
            if (node is NodeAction)
            {
                if (((NodeAction)node).action != null)
                {
                    MyAction action = ((NodeAction)node).action as MyAction;
                    pstr.a(action.triggerType);
                    pstr.a("\t");
                    pstr.a(action.hideSelf.ToString().ToLower());
                    pstr.a("\t");
                    pstr.a(action.talkId);
                    pstr.a("\t");
                    pstr.a(action.npcCfg);
                    pstr.a("\t");
                    pstr.a(action.boxCfg);
                    pstr.a("\t");
                }
                else
                {
                    pstr.a(0);
                    pstr.a("\t");
                    pstr.a("false");
                    pstr.a("\t");
                    pstr.a(0);
                    pstr.a("\t");
                    pstr.a("");
                    pstr.a("\t");
                    pstr.a(0);
                    pstr.a("\t");
                }
            }
            else
            {
                pstr.a(0);
                pstr.a("\t");
                pstr.a("false");
                pstr.a("\t");
                pstr.a(0);
                pstr.a("\t");
                pstr.a("");
                pstr.a("\t");
                pstr.a(0);
                pstr.a("\t");
            }
            pstr.a(node.result2);
            pstr.a("\t");
            pstr.a(node.result1);
            pstr.a("\t");
            pstr.a("");

            pstr.a("\n");
        }
        Debug.Log(pstr.e());
    }