From dbf5fe281bea65b166b05dc783f50a9eda2ce04b Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期一, 25 二月 2019 20:56:37 +0800
Subject: [PATCH] 3335 新版装备开发。

---
 System/Equip/EquipSet.cs         |  160 ++++++++++++++++++++++++++++++++
 System/Equip/EquipModel.cs       |   24 ++++
 System/Equip/EquipSlot.cs        |   16 +++
 System/Equip.meta                |    9 +
 System/Equip/EquipModel.cs.meta  |   12 ++
 System/Equip/EquipSlot.cs.meta   |   12 ++
 System/Equip/EquipSet.cs.meta    |   12 ++
 System/WindowBase/ModelCenter.cs |    1 
 8 files changed, 246 insertions(+), 0 deletions(-)

diff --git a/System/Equip.meta b/System/Equip.meta
new file mode 100644
index 0000000..bd91e0e
--- /dev/null
+++ b/System/Equip.meta
@@ -0,0 +1,9 @@
+fileFormatVersion: 2
+guid: 408cda0fe9174ca4eac9ce32502fdcb0
+folderAsset: yes
+timeCreated: 1551096728
+licenseType: Pro
+DefaultImporter:
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/Equip/EquipModel.cs b/System/Equip/EquipModel.cs
new file mode 100644
index 0000000..c26a29d
--- /dev/null
+++ b/System/Equip/EquipModel.cs
@@ -0,0 +1,24 @@
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Snxxz.UI
+{
+    public class EquipModel : Model
+    {
+
+        Dictionary<int, EquipSet> equipSets = new Dictionary<int, EquipSet>();
+
+        public override void Init()
+        {
+
+        }
+
+        public override void UnInit()
+        {
+
+        }
+
+    }
+}
+
diff --git a/System/Equip/EquipModel.cs.meta b/System/Equip/EquipModel.cs.meta
new file mode 100644
index 0000000..4d2a3cd
--- /dev/null
+++ b/System/Equip/EquipModel.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: f3ee6b5bd5b76714b87a241feedd3937
+timeCreated: 1551096748
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/Equip/EquipSet.cs b/System/Equip/EquipSet.cs
new file mode 100644
index 0000000..2464fc4
--- /dev/null
+++ b/System/Equip/EquipSet.cs
@@ -0,0 +1,160 @@
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Snxxz.UI
+{
+
+    public class EquipSet
+    {
+        public readonly int level;
+        public bool unLocked { get; set; }
+        Redpoint redpoint = new Redpoint(1);
+        Dictionary<int, EquipSlot> equipSlots = new Dictionary<int, EquipSlot>();
+
+        public EquipSet(int level)
+        {
+            this.level = level;
+        }
+
+        public void UnLock()
+        {
+
+        }
+
+        public void UpdateEquipSlots()
+        {
+
+        }
+
+        public bool IsSlotUnLocked(int place)
+        {
+            if (!equipSlots.ContainsKey(place))
+            {
+                return false;
+            }
+
+            return equipSlots[place].unLocked;
+        }
+
+        public int GetStarLevel(int place)
+        {
+            if (!equipSlots.ContainsKey(place))
+            {
+                return 0;
+            }
+
+            return equipSlots[place].starLevel;
+        }
+
+        public ItemModel GetEquip(int place)
+        {
+            if (!equipSlots.ContainsKey(place))
+            {
+                return null;
+            }
+
+            return equipSlots[place].equip;
+        }
+
+        public void PutOn(int place, ItemModel item)
+        {
+            if (item == null)
+            {
+                return;
+            }
+
+            if (!equipSlots.ContainsKey(place))
+            {
+                return;
+            }
+
+            var slot = equipSlots[place];
+            if (!slot.unLocked)
+            {
+                return;
+            }
+
+            if (!IsPlaceCompatible(place, item.equipPlace))
+            {
+                return;
+            }
+
+            slot.equip = item;
+        }
+
+        public void TakeOff(int place)
+        {
+            if (!equipSlots.ContainsKey(place))
+            {
+                return;
+            }
+
+            var slot = equipSlots[place];
+            slot.equip = null;
+        }
+
+        public void UpdateStarLevel(int place, int starLevel)
+        {
+            if (!equipSlots.ContainsKey(place))
+            {
+                return;
+            }
+
+            var slot = equipSlots[place];
+            slot.starLevel = starLevel;
+        }
+
+        public void UnLockSlot(int place)
+        {
+            if (!equipSlots.ContainsKey(place))
+            {
+                return;
+            }
+
+            var slot = equipSlots[place];
+            if (slot.unLocked)
+            {
+                return;
+            }
+
+            slot.unLocked = true;
+        }
+
+        public bool IsBetterThanCurrent(ItemModel item)
+        {
+            var place = item.equipPlace;
+            if (!equipSlots.ContainsKey(place))
+            {
+                return false;
+            }
+
+            var slot = equipSlots[place];
+            if (slot.unLocked)
+            {
+                return false;
+            }
+
+            var currentEquip = slot.equip;
+            if (currentEquip == null)
+            {
+                return true;
+            }
+
+            return item.equipScore >= currentEquip.equipScore;
+        }
+
+        private bool IsPlaceCompatible(int slotPlace, int equipPlace)
+        {
+            slotPlace = slotPlace == 10 ? 9 : slotPlace;
+            equipPlace = equipPlace == 10 ? 9 : equipPlace;
+            return slotPlace == equipPlace;
+        }
+
+    }
+
+
+
+}
+
+
diff --git a/System/Equip/EquipSet.cs.meta b/System/Equip/EquipSet.cs.meta
new file mode 100644
index 0000000..78440b6
--- /dev/null
+++ b/System/Equip/EquipSet.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: 5e6ca401fb2c59844b89e981c4a58bc0
+timeCreated: 1551096917
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/Equip/EquipSlot.cs b/System/Equip/EquipSlot.cs
new file mode 100644
index 0000000..d07d372
--- /dev/null
+++ b/System/Equip/EquipSlot.cs
@@ -0,0 +1,16 @@
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+
+namespace Snxxz.UI
+{
+    public class EquipSlot
+    {
+        public bool unLocked { get; set; }
+        public int starLevel { get; set; }
+        public ItemModel equip { get;  set; }
+
+    }
+
+}
+
diff --git a/System/Equip/EquipSlot.cs.meta b/System/Equip/EquipSlot.cs.meta
new file mode 100644
index 0000000..e03634b
--- /dev/null
+++ b/System/Equip/EquipSlot.cs.meta
@@ -0,0 +1,12 @@
+fileFormatVersion: 2
+guid: e1fa9aacd2e109c4c954083ce08738e4
+timeCreated: 1551097235
+licenseType: Pro
+MonoImporter:
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/System/WindowBase/ModelCenter.cs b/System/WindowBase/ModelCenter.cs
index 60a9627..88fb6a5 100644
--- a/System/WindowBase/ModelCenter.cs
+++ b/System/WindowBase/ModelCenter.cs
@@ -229,6 +229,7 @@
             RegisterModel<NewYearFairylandCeremonyModel>();
             RegisterModel<JadeDynastyGemModel>();
             RegisterModel<LuckyTreasureModel>();
+            RegisterModel<EquipModel>();
             inited = true;
         }
 

--
Gitblit v1.8.0