Пример #1
0
        //------------------------------------------------------
        // state register
        //------------------------------------------------------

        void SetRegisterAddress(AssetPostAddress address)
        {
            m_registerAddress  = address ?? new AssetPostAddress();
            m_patternEnabled   = false;
            m_needArgmentCount = GetFormatArgumentCount(m_registerAddress.assetPathFormat);
            SetState(StateRegisterAddress);
        }
Пример #2
0
 void SetEditAddress(AssetPostAddress address)
 {
     m_edittingAddress  = address ?? new AssetPostAddress();
     m_patternEnabled   = false;
     m_needArgmentCount = GetFormatArgumentCount(m_edittingAddress.assetPathFormat);
     m_mode             = Mode.RegisterAddress;
 }
Пример #3
0
        bool AddressField(Rect position, AssetPostAddress address)
        {
            bool deleteFlag = false;

            GUI.enabled = m_orderingAddress == null || m_orderingAddress == address;
            OrderField(GetRectFromHead(ref position, m_listToggle.fixedWidth), address);

            GUI.enabled = m_orderingAddress == null;

            if (GUI.Button(GetRectFromTail(ref position, 32), "削除", m_btnRightStyle))
            {
                if (EditorUtility.DisplayDialog("配達先削除", string.Format("配達先[{0}]を本当に削除しますか?", address.name), "削除"))
                {
                    deleteFlag = true;
                }
            }

            if (GUI.Button(GetRectFromTail(ref position, 32), "編集", m_btnLeftStyle))
            {
                SetRegisterAddress(address);
            }

            GUI.enabled = m_orderingAddress == null || m_orderingAddress == address;
            EditorGUI.LabelField(position, address.name);

            GUI.enabled = true;

            return(deleteFlag);
        }
Пример #4
0
        void RegisterAddress()
        {
            if (!m_addressbook.addressList.Contains(m_edittingAddress))
            {
                m_addressbook.addressList.Add(m_edittingAddress);
                m_addressbook.addressList.Sort((x, y) => x.name.CompareTo(y.name));
            }
            m_addressbook.Save();
            UpdatePostman();

            m_edittingAddress = null;
            m_mode            = Mode.Addressbook;
        }
Пример #5
0
        //------------------------------------------------------
        // unity system function
        //------------------------------------------------------

        void OnEnable()
        {
            titleContent = new GUIContent("Asset Post");
            minSize      = new Vector2(330f, 100f);

            m_addressbook = AssetPostAddressBook.Load();
            UpdatePostman();
            m_orderingAddress = null;

            InitGUI();

            SetState(StateDelivery);
        }
Пример #6
0
        void RegisterAddress()
        {
            Assert.IsTrue(CanRegisterAddress());

            if (!m_addressbook.addressList.Contains(m_registerAddress))
            {
                m_addressbook.addressList.Add(m_registerAddress);
            }
            m_addressbook.Save();
            UpdatePostman();

            m_registerAddress = null;
            SetState(StateAddressbook);
        }
Пример #7
0
        void EditAddress(AssetPostAddress address)
        {
            address.name            = EditorGUILayout.TextField("登録名", address.name ?? string.Empty);
            address.fileNamePattern = EditorGUILayout.TextField(kPatternContent, address.fileNamePattern);

            EditorGUILayout.Space();

            EditorGUILayout.LabelField("お届け先", m_labelStyle);
            EditorGUI.BeginChangeCheck();
            var labelWidth = EditorGUIUtility.labelWidth;

            EditorGUIUtility.labelWidth = 45;
            address.assetPathFormat     = EditorGUILayout.TextField(kAssetPathContent, address.assetPathFormat);
            EditorGUIUtility.labelWidth = labelWidth;
            if (EditorGUI.EndChangeCheck())
            {
                m_needArgmentCount = GetFormatArgumentCount(address.assetPathFormat);
            }

            ++EditorGUI.indentLevel;
            EditorGUILayout.LabelField("format引数設定 - ファイル名をSplitして使う");

            address.separators = SeparatorsField(address.separators, address.fileNamePattern);

            for (int i = 0; i < address.argumentList.Count; ++i)
            {
                if (ArgumentInfoField(i, address.argumentList[i]))
                {
                    address.argumentList.RemoveAt(i--);
                }
            }

            EditorGUILayout.BeginHorizontal();
            GUILayout.FlexibleSpace();
            if (GUILayout.Button("引数追加", m_plusStyle))
            {
                var info = new AssetPostAddress.ArgumentInfo();
                address.argumentList.Add(info);
            }
            EditorGUILayout.EndHorizontal();

            if (address.argumentList.Count < m_needArgmentCount)
            {
                EditorGUILayout.HelpBox("引数の数がたりません", MessageType.Warning);
            }

            --EditorGUI.indentLevel;
        }
Пример #8
0
        void OrderField(Rect position, AssetPostAddress address)
        {
            var e         = Event.current;
            var controlID = EditorGUIUtility.GetControlID(FocusType.Passive);

            switch (e.GetTypeForControl(controlID))
            {
            case EventType.Repaint:
                m_listToggle.Draw(position, false, false, m_orderingAddress == address, false);
                break;

            case EventType.MouseDown:
                if (position.Contains(e.mousePosition) && GUIUtility.hotControl == 0)
                {
                    m_orderingAddress     = address;
                    m_orderChanged        = false;
                    GUIUtility.hotControl = controlID;
                    e.Use();
                }
                break;

            case EventType.MouseLeaveWindow:
            case EventType.MouseUp:
                //if (GUIUtility.hotControl == controlID) 順番がずれるからControlId比較じゃダメだ
                if (m_orderingAddress == address)
                {
                    m_orderingAddress     = null;
                    GUIUtility.hotControl = 0;
                    e.Use();

                    if (m_orderChanged)
                    {
                        m_addressbook.Save();
                        UpdatePostman();
                        m_orderChanged = false;
                    }
                }
                break;
            }
        }
Пример #9
0
        bool AddressField(AssetPostAddress address)
        {
            bool deleteFlag = false;

            EditorGUILayout.BeginHorizontal();

            if (GUILayout.Button("編集", GUILayout.Width(32)))
            {
                SetEditAddress(address);
            }

            EditorGUILayout.LabelField(address.name);

            if (GUILayout.Button(GUIContent.none, m_deleteBtnStyle, GUILayout.Width(16)))
            {
                if (EditorUtility.DisplayDialog("配達先削除", string.Format("配達先[{0}]を本当に削除しますか?", address.name), "削除"))
                {
                    deleteFlag = true;
                }
            }

            EditorGUILayout.EndHorizontal();
            return(deleteFlag);
        }
Пример #10
0
 void OnLostFocus()
 {
     m_orderingAddress = null;
 }
Пример #11
0
        //------------------------------------------------------
        // lifetime
        //------------------------------------------------------

        public AssetPostman(AssetPostAddress address)
        {
            m_address       = address;
            m_fileNameRegex = new Regex(address.fileNamePattern);
        }