admin管理员组

文章数量:1531363

2024年6月19日发(作者:)

72 }

73

74 public static void AddCustomSize(GameViewSizeType viewSizeType, GameViewSizeGroupType sizeGroupType, int width, int height, string text)

75 {

76 // GameViewSizes group = up(sizeGroupTyge);

77 // tomSize(new GameViewSize(viewSizeType, width, height, text);

78

79 var group = GetGroup(sizeGroupType);

80 var addCustomSize = hod("AddCustomSize"); // or e().

81 var gvsType = typeof(Editor).e("ewSize");

82 var ctor = structor(new Type[] { typeof(int), typeof(int), typeof(int), typeof(string) });

83 var newSize = (new object[] { (int)viewSizeType, width, height, text });

84 (group, new object[] { newSize });

85 }

86

87 public static bool SizeExists(GameViewSizeGroupType sizeGroupType, string text)

88 {

89 return FindSize(sizeGroupType, text) != -1;

90 }

91

92 public static int FindSize(GameViewSizeGroupType sizeGroupType, string text)

93 {

94 // GameViewSizes group = up(sizeGroupType);

95 // string[] texts = playTexts();

96 //

97

98 var group = GetGroup(sizeGroupType);

99 var getDisplayTexts = e().GetMethod("GetDisplayTexts");

100 var displayTexts = (group, null) as string[];

101 for (int i = 0; i < ; i++)

102 {

103 string display = displayTexts[i];

104 // the text we get is "Name (W:H)" if the size has a name, or just "W:H" e.g. 16:9

105 // so if we're querying a custom size text we substring to only get the name

106 // You could see the outputs by just logging

107 // (display);

108 int pren = f('(');

109 if (pren != -1)

110 display = ing(0, pren - 1); // -1 to remove the space that's before the prens. This is very implementation-depdenent

111 if (display == text)

112 return i;

113 }

114 return -1;

115 }

116

117 public static bool SizeExists(GameViewSizeGroupType sizeGroupType, int width, int height)

118 {

119 return FindSize(sizeGroupType, width, height) != -1;

120 }

121

122 public static int FindSize(GameViewSizeGroupType sizeGroupType, int width, int height)

123 {

124 // goal:

125 // GameViewSizes group = up(sizeGroupType);

126 // int sizesCount = ltinCount() + tomCount();

127 // iterate through the sizes via eViewSize(int index)

128

129 var group = GetGroup(sizeGroupType);

130 var groupType = e();

131 var getBuiltinCount = hod("GetBuiltinCount");

132 var getCustomCount = hod("GetCustomCount");

133 int sizesCount = (int)(group, null) + (int)(group, null);

134 var getGameViewSize = hod("GetGameViewSize");

135 var gvsType = Type;

136 var widthProp = perty("width");

137 var heightProp = perty("height");

138 var indexValue = new object[1];

139 for (int i = 0; i < sizesCount; i++)

140 {

141 indexValue[0] = i;

142 var size = (group, indexValue);

143 int sizeWidth = (int)ue(size, null);

144 int sizeHeight = (int)ue(size, null);

145 if (sizeWidth == width && sizeHeight == height)

146 return i;

147 }

148 return -1;

149 }

150

151 static object GetGroup(GameViewSizeGroupType type)

152 {

153 return (gameViewSizesInstance, new object[] { (int)type });

154 }

155

156 //[MenuItem("Test/LogCurrentGroupType")]

157 //public static void LogCurrentGroupType()

158 //{

159 // (GetCurrentGroupType());

160 //}

161 public static GameViewSizeGroupType GetCurrentGroupType()

162 {

163 var getCurrentGroupTypeProp = e().GetProperty("currentGroupType");

164 return (GameViewSizeGroupType)(int)ue(gameViewSizesInstance, null);

165 }

166 public static void switchOrientation()

167 {

168 int width = ;

169 int height = ;

170 int index = FindSize(GetCurrentGroupType(), width, height);

171 if (index == -1)

172 {

173 AddCustomSize(esolution, GetCurrentGroupType(), width, height, "");

174 index = FindSize(GetCurrentGroupType(), width, height);

175 }

176 if (index != -1)

177 {

178 SetSize(index);

179 }

180 else

181 {

182 or("switchOrientation failed, can not find or add resoulution for " + ng() + "*" + ng());

183 }

184 }

185 }

186 #endif

本文标签: 模式屏幕修改编辑器分辨率