Example #1
0
    public Sprite GetSprite(string spriteName)
    {
        Sprite sprite = null;

        if (!_sprites.TryGetValue(spriteName, out sprite))
        {
            JDebugger.Log(this, "Can't Find Sprite " + spriteName);
        }

        return(sprite);
    }
Example #2
0
    public void RemoveContent(int idx)
    {
        if (idx >= _contentList.Count)
        {
            JDebugger.Log(this, "RemoveContent parameter idx is out of range");
            return;
        }

        _contentList.RemoveAt(idx);
        Refresh();
    }
Example #3
0
    //this function use vector3's first element
    public static void ValueTo(GameObject target, float startVal, float endVal, float time, float delay, TweenAction updateAction, TweenAction completeAction = null, EaseType easeType = EaseType.Linear)
    {
        if (updateAction == null)
        {
            JDebugger.Log("JTween ValueTo updateAction must be registered");
            return;
        }

        JTweenFactor factor = new JTweenFactor(TweenType.Value, easeType, target, new Vector3(startVal, 0, 0), new Vector3(endVal, 0, 0), time, delay, updateAction, completeAction);

        _factorList.Add(factor);
    }
Example #4
0
    private int GetPrefabIdx(string name)
    {
        for (int i = 0; i < _prefabList.Count; i++)
        {
            if (string.Compare(_prefabList[i].name, name) == 0)
            {
                return(i);
            }
        }

        JDebugger.Log("Prefab name : " + name + " doesn't exist in prefabList. return -1");
        return(-1);
    }
Example #5
0
    public void RemoveContent(GameObject obj)
    {
        for (int i = 0; i < _contentList.Count; i++)
        {
            if (obj == _contentList[i])
            {
                RemoveContent(i);
                return;
            }
        }

        JDebugger.Log(this, "RemoveContent can't find obj ");
    }
Example #6
0
    public static byte[] ReadFileAndMakeBinaryFile(string folderPath, string fileName)
    {
        string path = Path.Combine(folderPath, fileName);

        JDebugger.Log("[ReadFileAndMakeBinaryFile] File path : " + path);

        if (!File.Exists(path))
        {
            JDebugger.Log("[ReadFileAndMakeBinaryFile] File dosnt exist " + fileName);
            return(null);
        }

        return(File.ReadAllBytes(path));
    }
Example #7
0
    public Transform GetDeactivatedGroupTrans()
    {
        Camera[] cameras = Camera.allCameras;

        for (int i = 0; i < Camera.allCameras.Length; i++)
        {
            if (cameras[i].CompareTag("UICamera"))
            {
                return(cameras [i].transform.Find("UI_Canvas").Find("Deactivated"));
            }
        }

        JDebugger.Log("Can't find DeactivatedGroupTrans");
        return(null);
    }
Example #8
0
    public void Pop()
    {
        if (Empty())
        {
            JDebugger.Log("PanelStackManager Is Empty");
            return;
        }

        int lastIdx = popupStack.Count - 1;

        UIPanel popup = popupStack[lastIdx].GetComponent <UIPanel>();

        popup.StartClosePopup();

        popupStack.RemoveAt(lastIdx);
    }
Example #9
0
    public void Init()
    {
        if (_prefab == null)
        {
            JDebugger.Log(this, "UI Scroll View : Prefab is not allocated by user");
            return;
        }

        GridLayoutGroup grid = _grid.GetComponent <GridLayoutGroup>();

        grid.cellSize = _prefab.GetComponent <RectTransform>().sizeDelta;

        // scrollRect -> horizontal ? grid -> vertical
        // scrollRect -> vertical ? grid -> horizontal
        if (_scrollRect.horizontal)
        {
            grid.startAxis = GridLayoutGroup.Axis.Vertical;
        }
        else
        {
            grid.startAxis = GridLayoutGroup.Axis.Horizontal;
        }

        Vector2 contentSize = _rectTransform.sizeDelta;

        contentSize.y -= _scrollBarHorizontalTransform.sizeDelta.y;
        contentSize.x -= _scrollBarVerticalTransform.sizeDelta.x;

        if (_scrollRect.horizontal && grid.cellSize.y > contentSize.y)
        {
            contentSize.y = grid.cellSize.y;
        }
        else if (_scrollRect.vertical && grid.cellSize.x > contentSize.x)
        {
            contentSize.x = grid.cellSize.x;
        }

        _contents.sizeDelta = contentSize;
        _grid.sizeDelta     = contentSize;

        SetContentsRectSize();
    }
Example #10
0
    public void SetActiveTabButton(int idx)
    {
        if (idx >= _tabButtons.Length)
        {
            JDebugger.Log("tab button idx is out of range");
            return;
        }

        for (int i = 0; i < _tabButtons.Length; i++)
        {
            if (i == idx)
            {
                _tabButtons[i].Activate(true);
            }
            else
            {
                _tabButtons [i].Activate(false);
            }
        }
    }
Example #11
0
    public void SetDialogList()
    {
        List <string[]> dialogList = TextParser.LoadFile(ResourcesPath.CSV_FolderFath + ResourcesPath.CSV_Dialog);

        if (dialogList == null)
        {
            return;
        }

        for (int i = 0; i < dialogList.Count; i++)
        {
            string[] line = dialogList [i];
            if (line == null)
            {
                JDebugger.Log("SetDialogList () - string is null");
                return;
            }

            DialogList.Add(int.Parse(line [0]), new DialogInfo(int.Parse(line[0]), int.Parse(line[1]), line[2], line[3]));
        }
    }
Example #12
0
    private GameObject AddObjectEx(List <GameObject> list, string name, int count)
    {
        Transform  rootTrans = GetRootTransform(name);
        GameObject obj       = null;

        for (int i = count - 1; i >= 0; i--)
        {
            GameObject prefab = null;
            if (!_prefabList.TryGetValue(name, out prefab))
            {
                JDebugger.Log("prefab : " + name + " doesnt exist in prefabList. return null");
                return(null);
            }

            obj = GameObject.Instantiate(prefab, rootTrans);
            obj.SetActive(false);
            list.Add(obj);
        }

        return(obj);
    }
Example #13
0
    public static Dictionary <int, V> CSVToDicationary <V>(string filePath) where V : IDeserializable, new()
    {
        List <string[]> stringList = LoadCSVFile(filePath);

        if (stringList.Count < 2)
        {
            JDebugger.Log("CSVToDicationary stringList count < 2");
            return(null);
        }

        Dictionary <int, V> result = new Dictionary <int, V> ();

        string[] header = stringList [0];

        for (int r_i = 1; r_i < stringList.Count; r_i++)
        {
            string[] row = stringList [r_i];

            if (header.Length != row.Length)
            {
                JDebugger.Log("CSVToDicationary header.Length != row.Length");
                return(null);
            }

            V value = new V();

            for (int c_i = 0; c_i < row.Length; c_i++)
            {
                FieldInfo fieldInfo = typeof(V).GetField(FilteringCell(header[c_i]));

                if (fieldInfo == null)
                {
                    JDebugger.Log("[fieldInfo] " + header[c_i] + " is not match witch field name.");
                    return(null);
                }

                if (fieldInfo.FieldType == typeof(int))
                {
                    fieldInfo.SetValue(value, int.Parse(row[c_i]));
                }
                else if (fieldInfo.FieldType == typeof(float))
                {
                    fieldInfo.SetValue(value, float.Parse(row[c_i]));
                }
                else if (fieldInfo.FieldType == typeof(long))
                {
                    fieldInfo.SetValue(value, long.Parse(row[c_i]));
                }
                else if (fieldInfo.FieldType == typeof(string))
                {
                    fieldInfo.SetValue(value, FilteringCell(row[c_i]));
                }
                else if (fieldInfo.FieldType == typeof(List <int>))
                {
                    string     rowValue = FilteringCell(row [c_i]);
                    string[]   values   = rowValue.Split(':');
                    List <int> list     = new List <int>();
                    for (int v_i = 0; v_i < values.Length; v_i++)
                    {
                        list.Add(int.Parse(values [v_i]));
                    }
                    fieldInfo.SetValue(value, list);
                }
            }

            result.Add(int.Parse(row[0]), value);
        }

        return(result);
    }