Example #1
0
    public void set_valarri(string v_header_name, int v_row, LuaTable v_table)
    {
        LuaArrayTable arr_info = v_table.ToArrayTable();
        StringBuilder sb       = new StringBuilder();
        int           idx      = 1;

        for (int i = 1; i < arr_info.Length; i++)
        {
            var data = arr_info[i];
            if (sb.Length > 0)
            {
                sb.Append(',');
            }
            if (data != null)
            {
                if (data is double || data is int)
                {
                    sb.Append((int)Convert.ToDouble(data));
                }
                else
                {
                    ZFDebug.Info(string.Format("v_table[{0}] is not number", idx));
                }
            }
            else
            {
                ZFDebug.Info(string.Format("v_table[{0}] = nil", idx));
            }
            idx = idx + 1;
        }
        set_val(v_header_name, v_row, sb.ToString());
    }
Example #2
0
        public void CreateThePanel(int v_layer, string v_logicName, string v_abname, string v_assetName, string v_panelName, LuaFunction v_func = null)
        {
            string    assetName = v_assetName;
            string    abName    = v_abname.ToLower() + AppConst.ExtName;
            Transform Parent    = getParent(v_layer);

            if (Parent.Find(name) != null)
            {
                return;
            }
            ResManager.LoadPrefab(abName, assetName, delegate(UnityEngine.Object[] objs) {
                GameObject go = _BuildNewPanel(objs, v_logicName, abName, assetName, v_panelName);
                go.transform.SetParent(Parent);
                if (go == null)
                {
                    ZFDebug.Error("create panel failed, logic name is " + v_logicName);
                    return;
                }
                go.SetActive(false);
                if (v_func != null)
                {
                    v_func.Call(go);
                }
            });
        }
Example #3
0
    public void init_data(string v_pmkey = "id", int v_row_begin = 3)
    {
        m_src_infos = new Dictionary <CellPoint, List <object> >();
        Excel.Cells data = m_sheet.Cells;
        int         col  = m_header.get_col(v_pmkey);

        if (col < 0)
        {
            ZFDebug.Error(string.Format("{0}中没找到名为{1}的列", m_sheet_name, v_pmkey));
            return;
        }
        pm_index = new Dictionary <string, int>();
        for (int i = v_row_begin; i < 100000; i++)
        {
            object test_obj = data[i, col].Value;
            if (test_obj == null)
            {
                break;
            }
            if (!pm_index.ContainsKey(test_obj.ToString()))
            {
                pm_index.Add(test_obj.ToString(), i);
            }
        }
    }
Example #4
0
 //[MenuItem("Custom/执行Main")]
 static void DoMain()
 {
     if (_client == null)
     {
         var es = GameObject.Find("EventSystem");
         _client = es.GetComponent <EditorMain>();
         if (_client == null)
         {
             _client = es.AddComponent <EditorMain>();
         }
         _client.init();
     }
     else
     {
         _client.reload();
     }
     try
     {
         _client.test();
     }
     catch (Exception ex)
     {
         ZFDebug.Error(ex.ToString());
     }
 }
Example #5
0
    public void set_valarrs(string v_header_name, int v_row, LuaTable v_table)
    {
        LuaArrayTable arr_info = v_table.ToArrayTable();
        StringBuilder sb       = new StringBuilder();

        for (int i = 1; i < arr_info.Length; i++)
        {
            var data = arr_info[i];
            if (sb.Length > 0)
            {
                sb.Append(',');
            }
            if (data != null)
            {
                if (data is string)
                {
                    sb.Append(Convert.ToString(data));
                }
                else
                {
                    ZFDebug.Info(string.Format("v_table[{0}] is not string", i));
                }
            }
            else
            {
                ZFDebug.Info(string.Format("v_table[{0}] = nil", i));
            }
        }
        set_val(v_header_name, v_row, sb.ToString());
    }
Example #6
0
    public double get_valf(int v_row, string v_header_name)
    {
        double rtn  = -1;
        object ortn = get_val(v_row, v_header_name);

        if (ortn == null)
        {
            return(rtn);
        }
        if (ortn is double)
        {
            rtn = (double)ortn;
        }
        else if (ortn is string)
        {
            if (!double.TryParse((string)ortn, out rtn))
            {
                ZFDebug.Error(string.Format("{0}不是int", (string)ortn));
            }
        }
        else
        {
            ZFDebug.Error(string.Format("{0}表{1}的列的数据类型无法解析", m_sheet_name, v_header_name));
        }
        return(rtn);
    }
Example #7
0
 public void init_data(string v_pmkey = "id", int v_row_begin = 3)
 {
     pm_index = new Dictionary <string, _PmLoc>();
     for (int i = 0; i < _sheets.Count; i++)
     {
         Excel.Worksheet theSheet  = _sheets[i].Sheet;
         ExcelHeader     theHeader = _sheets[i].Header;
         //m_src_infos = new Dictionary<CellPoint, List<object>>();
         Excel.Cells data = theSheet.Cells;
         int         col  = theHeader.get_col(v_pmkey);
         if (col < 0)
         {
             ZFDebug.Error(string.Format("{0}中没找到名为{1}的列", theSheet.Name, v_pmkey));
             return;
         }
         for (int row = v_row_begin; row < 100000; row++)
         {
             object test_obj = data[row, col].Value;
             if (test_obj == null)
             {
                 break;
             }
             if (!pm_index.ContainsKey(test_obj.ToString()))
             {
                 pm_index.Add(test_obj.ToString(), new _PmLoc(row, i));
             }
         }
     }
 }
Example #8
0
    public void clear_cell(string v_header_name, int v_row)
    {
        int col = m_header.get_col(v_header_name);

        if (col < 0)
        {
            ZFDebug.Error(string.Format("{0}中没找到名为{1}的列", m_sheet_name, v_header_name));
            return;
        }
        m_sheet.Cells[v_row, col].Value = null;
    }
Example #9
0
    public void set_valb(string v_header_name, int v_row, bool v_b)
    {
        int col = m_header.get_col(v_header_name);

        if (col < 0)
        {
            ZFDebug.Error(string.Format("{0}中没找到名为{1}的列", m_sheet_name, v_header_name));
            return;
        }
        m_sheet.Cells[v_row, col].Value = v_b ?true:false;
    }
Example #10
0
 //[MenuItem("Custom/导出Excel")]
 static void OutputExcel()
 {
     try
     {
         _client.output_excel();
     }
     catch (Exception ex)
     {
         ZFDebug.Error(ex.ToString());
     }
 }
Example #11
0
    public void calCrystall()
    {
        LuaFunction fun = luaState.GetFunction("recover_crystall");

        if (fun == null)
        {
            ZFDebug.Error("can't find the funtion named recover_crystall");
        }
        fun.Call(1, 1, 1, 6);
        fun.Dispose();
        fun = null;
    }
Example #12
0
    public void output_excel()
    {
        LuaFunction fun = luaState.GetFunction("output_excel");

        if (fun == null)
        {
            ZFDebug.Error("can't find the funtion named output_excel");
        }
        fun.Call();
        fun.Dispose();
        fun = null;
    }
Example #13
0
    public void test()
    {
        LuaFunction fun = luaState.GetFunction("test");

        if (fun == null)
        {
            ZFDebug.Error("can't find the funtion named test");
        }
        fun.Call();
        fun.Dispose();
        fun = null;
    }
Example #14
0
    public object get_val(int v_row, string v_header_name)
    {
        int col = m_header.get_col(v_header_name);

        if (col < 0)
        {
            ZFDebug.Error(string.Format("{0}中没找到名为{1}的列", m_sheet_name, v_header_name));
            return(null);
        }
        object val = m_sheet.Cells[v_row, col].Value;

        return(m_sheet.Cells[v_row, col].Value);
    }
Example #15
0
        public void Hide(int v_layer, string name)
        {
            var       panelName = name;
            Transform Parent    = getParent(v_layer);
            var       panelObj  = Parent.Find(panelName);

            if (panelObj == null)
            {
                ZFDebug.Error("Hide can't find the node " + name);
                return;
            }
            panelObj.gameObject.SetActive(false);
        }
Example #16
0
        public void Show(int v_layer, string name)
        {
            var       panelName = name;
            Transform Parent    = getParent(v_layer);
            var       panelObj  = Parent.Find(panelName);

            if (panelObj == null)
            {
                ZFDebug.Info(Parent.name + " " + Parent.childCount.ToString());
                ZFDebug.Error("can't find the panel named " + panelName);
                return;
            }
            panelObj.gameObject.SetActive(true);
        }
Example #17
0
    public ExcelSheetObject get_sheet(string v_sheet)
    {
        if (m_workbook != null)
        {
            var sheet = m_workbook.Worksheets[v_sheet];
            if (sheet == null)
            {
                ZFDebug.Error(string.Format("没找到名为{0}的sheet", v_sheet));
                return(null);
            }

            return(new ExcelSheetObject(sheet, v_sheet));
        }
        return(null);
    }
Example #18
0
        /// <summary>
        /// 关闭面板
        /// </summary>
        /// <param name="name"></param>
        public void ClosePanel(int v_layer, string name)
        {
            var       panelName = name;
            Transform Parent    = getParent(v_layer);
            var       panelObj  = Parent.Find(panelName);

            if (panelObj == null)
            {
                ZFDebug.Error("ClosePanel can't find the node " + name);
                return;
            }
            ;
            panelObj.SetParent(null);
            Destroy(panelObj.gameObject);
        }
Example #19
0
 static void CompileSproto()
 {
     try
     {
         LuaState l = getAndIniLuaState();
         l.DoFile("EditorMain");
         LuaFunction fun = l.GetFunction("CompileSproto");
         fun.Call();
         l.Dispose();
     }
     catch (Exception ex)
     {
         ZFDebug.Error(ex.ToString());
     }
 }
Example #20
0
    public void set_val_by_pmid(string v_pmkey, string v_col_name, object v_val)
    {
        int col = m_header.get_col(v_col_name);

        if (col < 0)
        {
            ZFDebug.Error(string.Format("{0}中没找到名为{1}的列", m_sheet_name, v_col_name));
            return;
        }
        if (!pm_index.ContainsKey(v_pmkey))
        {
            ZFDebug.Error(string.Format("{0}中没找到名为{1}的主键", m_sheet_name, v_pmkey));
            return;
        }
        int row = pm_index[v_pmkey];

        m_sheet.Cells[row, col].Value = v_val;
    }
Example #21
0
 public bool set_val_by_pmid(string v_pmkey, string v_col_name, object v_val)
 {
     if (pm_index.ContainsKey(v_pmkey))
     {
         _PmLoc           point     = pm_index[v_pmkey];
         ExcelSheetObject theSheet  = _sheets[point.sheetIdx];
         ExcelHeader      theHeader = theSheet.Header;
         int col = theHeader.get_col(v_col_name);
         if (col < 0)
         {
             ZFDebug.Error(string.Format("{0}中没找到名为{1}的列", theSheet, v_col_name));
             return(false);
         }
         int row = pm_index[v_pmkey].row;
         theSheet.Sheet.Cells[row, col].Value = v_val;
         return(true);
     }
     return(false);
 }
Example #22
0
    public string get_vals(int v_row, string v_header_name)
    {
        string rtn  = "";
        object ortn = get_val(v_row, v_header_name);

        if (ortn == null)
        {
            return(rtn);
        }
        if (ortn is string)
        {
            rtn = (string)ortn;
        }
        else if (ortn is string)
        {
            rtn = ortn.ToString();
        }
        else
        {
            ZFDebug.Error(string.Format("{0}{1}的列的数据类型无法解析", m_sheet_name, v_header_name));
        }
        return(rtn);
    }
Example #23
0
    public void Add_val_by_pmid(string v_pmkey, string v_col_name, object v_val)
    {
        int col = m_header.get_col(v_col_name);

        if (col < 0)
        {
            ZFDebug.Error(string.Format("{0}中没找到名为{1}的列", m_sheet_name, v_col_name));
            return;
        }
        if (!pm_index.ContainsKey(v_pmkey))
        {
            ZFDebug.Error(string.Format("{0}中没找到名为{1}的主键", m_sheet_name, v_pmkey));
            return;
        }
        int       row = pm_index[v_pmkey];
        CellPoint cp  = new CellPoint(row, col);

        if (!m_src_infos.ContainsKey(cp))
        {
            m_src_infos.Add(cp, new List <object>());
        }
        m_src_infos[cp].Add(v_val);
    }
Example #24
0
        private GameObject _BuildNewPanel(UnityEngine.Object[] objs, string v_logicName, string v_abname, string v_assetName, string v_panelName)
        {
            if (objs.Length == 0)
            {
                ZFDebug.Error(string.Format("can't find the uiRes abName = {0}, assetName = {1}", v_abname, v_assetName));
                return(null);
            }
            GameObject prefab = objs[0] as GameObject;

            if (prefab == null)
            {
                return(null);
            }

            GameObject go = Instantiate(prefab) as GameObject;

            go.name  = v_panelName;
            go.layer = LayerMask.NameToLayer("UI");
            //go.transform.SetParent(Parent);
            //go.transform.localScale = Vector3.one;
            //go.transform.localPosition = Vector3.zero;
            RectTransform rt = go.GetComponent <RectTransform>();
            //rt.localPosition = Vector3.zero;
            //rt.localScale = Vector3.one;
            //rt.localRotation = Quaternion.Euler(0, 0, 0);
            //rt.anchorMin = new Vector2(0.5f, 0.5f);
            //rt.anchorMax = new Vector2(0.5f, 0.5f);
            //rt.pivot = new Vector2(0.5f, 0.5f);
            //rt.sizeDelta = new Vector2(750,1334);
            //rt.ForceUpdateRectTransforms();
            var comLuabehaviour = go.AddComponent <LuaBehaviour>();

            comLuabehaviour.sLogicName  = v_logicName;
            comLuabehaviour.sBundleName = v_abname;
            return(go);
        }