少年修仙传客户端代码仓库
hch
2025-07-24 50e53441950268933694eeb5aad36147bbe1014d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
//--------------------------------------------------------
//    [Author]:           第二世界
//    [  Date ]:           Wednesday, September 06, 2017
//--------------------------------------------------------
 
using vnxbqy.UI;
using System;
using System.Collections;
using System.Collections.Generic;
 
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
 
namespace vnxbqy.UI
{
 
    public enum KnapsackFuncTitle
    {
        bag,
        store,
        depot, //仓库
        devour, //吞噬
        //后续IL开发添加预设
        default1,
        default2,
        default3,
        default4,
    }
 
    public class KnapSackWin : OneLevelWin
    {
        PackModel playerPack { get { return ModelCenter.Instance.GetModel<PackModel>(); } }
        public static KnapsackFuncTitle titleType = KnapsackFuncTitle.bag;
        public static bool jumpByRedpoint = false;  //打开时受红点影响跳转
        protected Image m_LeftTop;
        protected override void AddListeners()
        {
            base.AddListeners();
 
            SetFunctionListener(0, OnClickBagTitle);
            SetFunctionListener(1, OnClickStoreTitle);
            SetFunctionListener(2, OnClickDepotTitle);
            SetFunctionListener(3, OnClickDevourTitle);
        }
 
        protected override void OnActived()
        {
            this.transform.SetAsLastSibling();
            if (playerPack.lookLineIndex == -1 && jumpByRedpoint)
            {
                if (playerPack.redpointEquipDecom.state == RedPointState.Simple)
                {
                    functionOrder = 3;
                }
            }
            jumpByRedpoint = false;
 
            base.OnActived();
 
            m_LeftTop = this.GetComponent<Image>("Pivot/Container_Decorate/Img_LeftTop");
            m_LeftTop.SetActive(false);
            m_Left.SetActive(false);
            m_Right.SetActive(false);
        }
 
        protected override void OnPreClose()
        {
            titleType = KnapsackFuncTitle.bag;
            playerPack.SetLookIndex(null);
            playerPack.isPlayBetterEquipEffect = false;
            LocalSave.DeleteKey(PackModel.RecordKnapsackTitle);
 
            base.OnPreClose();
        }
 
        private void OnClickDepotTitle()
        {
            CloseSubWindows();
            titleType = KnapsackFuncTitle.depot;
            WindowCenter.Instance.Open<DepotWin>();
            WindowCenter.Instance.Open<BagWin>();
            playerPack.SetLookIndex(null);
            playerPack.isPlayBetterEquipEffect = false;
            functionOrder = 2;
        }
 
        private void OnClickStoreTitle()
        {
            CloseSubWindows();
            titleType = KnapsackFuncTitle.store;
 
            WindowCenter.Instance.Open<BagStoreWin>();
            playerPack.SetLookIndex(null);
            playerPack.isPlayBetterEquipEffect = false;
            functionOrder = 1;
        }
 
        private void OnClickBagTitle()
        {
            CloseSubWindows();
            titleType = KnapsackFuncTitle.bag;
            
            WindowCenter.Instance.Open<RoleEquipWin>();
            WindowCenter.Instance.Open<BagWin>();
            WindowCenter.Instance.Open<RealmEquipWin>();
            WindowCenter.Instance.Open("BagSelectWin");
            functionOrder = 0;
        }
 
        private void OnClickDevourTitle()
        {
            if (!ItemLogicUtility.Instance.isPackResetOk) return;
 
            CloseSubWindows();
            titleType = KnapsackFuncTitle.devour;
 
            WindowCenter.Instance.Open<EquipDevourWin>();
            functionOrder = 3;
        }
 
        protected override void CloseSubWindows()
        {
            base.CloseSubWindows();
            WindowCenter.Instance.CloseImmediately("BagWin");
            WindowCenter.Instance.CloseImmediately("RealmEquipWin");
            WindowCenter.Instance.CloseImmediately("BagSelectWin");
        }
 
    }
 
}