public override void OnInspectorGUI() { _item = target as MahjongItem; _valueChange = false; EnumMahjongValue value = (EnumMahjongValue)EditorGUILayout.EnumPopup("麻将值", _item.SelfData.Value); EnumMahJongDirection direction = (EnumMahJongDirection)EditorGUILayout.EnumPopup("麻将方向", _item.SelfData.Direction); EnumMahJongAction action = (EnumMahJongAction)EditorGUILayout.EnumPopup("麻将动作", _item.SelfData.Action); EnumShowDirection showDirection = (EnumShowDirection)EditorGUILayout.EnumPopup("麻将实际显示方向", _item.SelfData.ShowDirection); int mahjongLayer = EditorGUILayout.IntField("基础层级", _item.SelfData.MahjongLayer); bool isLockValueType = EditorGUILayout.Toggle("是否锁定麻将值类型", _item.SelfData.LockValueType); if (!mahjongLayer.Equals(_item.SelfData.MahjongLayer)) { _item.SelfData.MahjongLayer = mahjongLayer; _valueChange = true; } if (!_item.SelfData.ShowDirection.Equals(showDirection)) { _item.SelfData.ShowDirection = showDirection; _valueChange = true; } if (!_item.SelfData.Value.Equals(value)) { _item.SelfData.Value = value; _valueChange = true; } if (!_item.SelfData.Direction.Equals(direction)) { _item.SelfData.Direction = direction; _valueChange = true; } if (!_item.SelfData.Action.Equals(action)) { _item.SelfData.Action = action; _valueChange = true; } if (showDirection.Equals(EnumShowDirection.Oppset)) { bool oppset = EditorGUILayout.Toggle("是否需要倒转牌的值", _item.SelfData.NeedOppsetValue); if (!_item.SelfData.NeedOppsetValue.Equals(oppset)) { _item.SelfData.NeedOppsetValue = oppset; _valueChange = true; } } if (_valueChange) { _item.OnDataChange(); } if (!isLockValueType.Equals(_item.SelfData.LockValueType)) { _item.SelfData.LockValueType = isLockValueType; } serializedObject.ApplyModifiedProperties(); if (GUI.changed) { EditorUtility.SetDirty(target); } }
public MahJongData(int value, EnumMahJongAction action, EnumMahJongDirection direction, EnumShowDirection showDirection) { _value = 0; _action = action; _direction = direction; _showDirection = showDirection; Debug.Log("初始化麻将"); }
public void SetNewItem(MahjongItem item, int value, EnumMahJongAction action) { item.Value = value; item.SelfData.Action = action; item.SetColor(Color.white); GameTools.AddChild(transform, item.transform); ItemList.Add(item); }
public override void OnInspectorGUI() { _pile = target as MahjongPile; EnumMahJongDirection direction = (EnumMahJongDirection)EditorGUILayout.EnumPopup("麻将方向", _pile.ItemDirection); EnumMahJongAction action = (EnumMahJongAction)EditorGUILayout.EnumPopup("麻将动作", _pile.ItemAction); EnumShowDirection show = (EnumShowDirection)EditorGUILayout.EnumPopup("麻将所属人", _pile.ItemShow); int baseLayer = EditorGUILayout.IntField("基础层级", _pile.BaseLayer); bool isAddLayer = EditorGUILayout.Toggle("层级是否递增", _pile.IsLayerAdd); float scaleX = EditorGUILayout.FloatField("X轴缩放", _pile.ItemScaleX); float scaleY = EditorGUILayout.FloatField("Y轴缩放", _pile.ItemScaleY); DefLayout layout = EditorGUILayout.ObjectField(new GUIContent("布局文件Layout"), _pile.Layout, typeof(DefLayout), true) as DefLayout; if (!direction.Equals(_pile.ItemDirection)) { _pile.ItemDirection = direction; } if (!action.Equals(_pile.ItemAction)) { _pile.ItemAction = action; } if (!show.Equals(_pile.ItemShow)) { _pile.ItemShow = show; } if (!baseLayer.Equals(_pile.BaseLayer)) { _pile.BaseLayer = baseLayer; } if (!isAddLayer.Equals(_pile.IsLayerAdd)) { _pile.IsLayerAdd = isAddLayer; } if (!scaleX.Equals(_pile.ItemScaleX)) { _pile.ItemScaleX = scaleX; } if (!scaleY.Equals(_pile.ItemScaleY)) { _pile.ItemScaleY = scaleY; } if (layout != null) { if (!layout.Equals(_pile.Layout)) { _pile.Layout = layout; } } serializedObject.ApplyModifiedProperties(); }
public virtual void ChangeAction(EnumMahJongAction action) { ItemAction = action; RefreshPile(); }
public MahJongData(int value, EnumMahJongAction action, EnumMahJongDirection direction) { _value = 0; _action = action; _direction = direction; }