Skip to content

Commit 4a23c5b

Browse files
committed
Final source code
1 parent 4ff1426 commit 4a23c5b

File tree

2,078 files changed

+323683
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,078 files changed

+323683
-0
lines changed

.vsconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"version": "1.0",
3+
"components": [
4+
"Microsoft.VisualStudio.Workload.ManagedGame"
5+
]
6+
}

Assets/GPM.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/GPM/CacheStorage.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/GPM/CacheStorage/Editor.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
using UnityEditor;
2+
using UnityEngine;
3+
using UnityEditor.IMGUI.Controls;
4+
using System;
5+
using System.IO;
6+
7+
namespace Gpm.CacheStorage
8+
{
9+
using Util;
10+
11+
internal class CacheStorageTreeItem : TreeViewItem, CacheStorageTreeView.IBaseTreeItem
12+
{
13+
public const string EXFIRES = "Exfires";
14+
public const string REQUEST = "Request";
15+
public const string REMOVE = "Remove";
16+
public const string NONE_DATA = "-";
17+
18+
internal CacheInfo cacheInfo;
19+
public CacheStorageTreeItem(CacheInfo cacheInfo) : base((int)cacheInfo.GetSpaceID())
20+
{
21+
this.cacheInfo = cacheInfo;
22+
}
23+
24+
public virtual void RowGUI()
25+
{
26+
}
27+
28+
public void CellGUI(Rect cellRect, int column)
29+
{
30+
CellGUI(cellRect, (CacheStorageTreeView.ColumnId)column);
31+
}
32+
33+
34+
public virtual void CellGUI(Rect cellRect, CacheStorageTreeView.ColumnId column)
35+
{
36+
switch (column)
37+
{
38+
case CacheStorageTreeView.ColumnId.NAME:
39+
{
40+
GUI.Label(cellRect, Path.GetFileName(cacheInfo.url));
41+
}
42+
break;
43+
case CacheStorageTreeView.ColumnId.URL:
44+
{
45+
GUI.Label(cellRect, cacheInfo.url);
46+
}
47+
break;
48+
case CacheStorageTreeView.ColumnId.SIZE:
49+
{
50+
GUI.Label(cellRect, Utility.GetSizeText(cacheInfo.contentLength));
51+
}
52+
break;
53+
case CacheStorageTreeView.ColumnId.EXFIRES:
54+
{
55+
int lifeTime = cacheInfo.GetFreshnessLifeTime();
56+
if (lifeTime > 0)
57+
{
58+
int remainTime = lifeTime - cacheInfo.GetCurrentAge();
59+
if (remainTime > 0)
60+
{
61+
EditorGUI.LabelField(cellRect, string.Format("{0}", Utility.GetTimeText(remainTime * TimeSpan.TicksPerSecond)));
62+
}
63+
else
64+
{
65+
GUI.color = Color.yellow;
66+
EditorGUI.LabelField(cellRect, EXFIRES);
67+
GUI.color = Color.white;
68+
}
69+
}
70+
else
71+
{
72+
EditorGUI.LabelField(cellRect, NONE_DATA);
73+
}
74+
75+
}
76+
break;
77+
case CacheStorageTreeView.ColumnId.REMAIN:
78+
{
79+
if(cacheInfo.IsAlways() == true)
80+
{
81+
EditorGUI.LabelField(cellRect, REQUEST);
82+
}
83+
else
84+
{
85+
double remainRequestTime = cacheInfo.GetRemainRequestTime();
86+
if (remainRequestTime > 0)
87+
{
88+
EditorGUI.LabelField(cellRect, string.Format("{0}", Utility.GetTimeText((long)(remainRequestTime * TimeSpan.TicksPerSecond))));
89+
}
90+
else
91+
{
92+
GUI.color = Color.yellow;
93+
EditorGUI.LabelField(cellRect, REQUEST);
94+
GUI.color = Color.white;
95+
}
96+
}
97+
}
98+
break;
99+
case CacheStorageTreeView.ColumnId.REMOVE:
100+
{
101+
double unusedTime = GpmCacheStorage.GetUnusedPeriodTime();
102+
double removeCycle = GpmCacheStorage.GetRemoveCycle();
103+
104+
double passTime = cacheInfo.GetPastTimeFromLastAccess();
105+
if (unusedTime > 0 && removeCycle > 0)
106+
{
107+
double sec = unusedTime - passTime;
108+
109+
if (sec > 0)
110+
{
111+
EditorGUI.LabelField(cellRect, string.Format("{0}", Utility.GetTimeText((long)(sec * TimeSpan.TicksPerSecond))));
112+
}
113+
else
114+
{
115+
GUI.color = Color.yellow;
116+
EditorGUI.LabelField(cellRect, REMOVE);
117+
GUI.color = Color.white;
118+
}
119+
120+
}
121+
else
122+
{
123+
GUI.enabled = false;
124+
GUI.Label(cellRect, NONE_DATA);
125+
GUI.enabled = true;
126+
}
127+
}
128+
break;
129+
}
130+
131+
132+
}
133+
}
134+
135+
}

Assets/GPM/CacheStorage/Editor/CacheStorageTreeItem.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)