@@ -184,14 +184,20 @@ class Platforms(object):
184
184
WEB = 'web'
185
185
WIN32 = 'win32'
186
186
LINUX = 'linux'
187
+ WP8 = "wp8"
188
+ WP8_1 = "wp8_1"
189
+ METRO = "metro"
187
190
188
191
CFG_CLASS_MAP = {
189
192
ANDROID : "cocos_project.AndroidConfig" ,
190
193
IOS : "cocos_project.iOSConfig" ,
191
194
MAC : "cocos_project.MacConfig" ,
192
195
WEB : "cocos_project.WebConfig" ,
193
196
WIN32 : "cocos_project.Win32Config" ,
194
- LINUX : "cocos_project.LinuxConfig"
197
+ LINUX : "cocos_project.LinuxConfig" ,
198
+ WP8 : "cocos_project.Wp8Config" ,
199
+ WP8_1 : "cocos_project.Wp8_1Config" ,
200
+ METRO : "cocos_project.MetroConfig"
195
201
}
196
202
197
203
@staticmethod
@@ -200,7 +206,7 @@ def list_for_display():
200
206
201
207
@staticmethod
202
208
def list ():
203
- return ( Platforms .ANDROID , Platforms . IOS , Platforms . MAC , Platforms . WEB , Platforms . WIN32 , Platforms . LINUX )
209
+ return Platforms .CFG_CLASS_MAP . keys ( )
204
210
205
211
def __init__ (self , project , current ):
206
212
self ._project = project
@@ -218,15 +224,21 @@ def __init__(self, project, current):
218
224
219
225
def _filter_platforms (self , platforms ):
220
226
ret = []
227
+ platforms_for_os = {
228
+ "linux" : [ Platforms .WEB , Platforms .LINUX , Platforms .ANDROID ],
229
+ "mac" : [ Platforms .WEB , Platforms .IOS , Platforms .MAC , Platforms .ANDROID ],
230
+ "win32" : [ Platforms .WEB , Platforms .WIN32 , Platforms .ANDROID , Platforms .WP8 ,
231
+ Platforms .WP8_1 , Platforms .METRO ]
232
+ }
221
233
for p in platforms :
222
234
if cocos .os_is_linux ():
223
- if p == Platforms . WEB or p == Platforms . LINUX or p == Platforms . ANDROID :
235
+ if p in platforms_for_os [ "linux" ] :
224
236
ret .append (p )
225
237
if cocos .os_is_mac ():
226
- if p == Platforms . WEB or p == Platforms . IOS or p == Platforms . MAC or p == Platforms . ANDROID :
238
+ if p in platforms_for_os [ "mac" ] :
227
239
ret .append (p )
228
240
if cocos .os_is_win32 ():
229
- if p == Platforms . WEB or p == Platforms . WIN32 or p == Platforms . ANDROID :
241
+ if p in platforms_for_os [ "win32" ] :
230
242
ret .append (p )
231
243
232
244
return ret
@@ -250,7 +262,7 @@ def _gen_available_platforms(self, proj_info):
250
262
else :
251
263
platform_list = [ Platforms .WEB ]
252
264
elif self ._project ._is_cpp_project ():
253
- platform_list = [ Platforms .ANDROID , Platforms .WIN32 , Platforms .IOS , Platforms .MAC , Platforms .LINUX ]
265
+ platform_list = [ Platforms .ANDROID , Platforms .WIN32 , Platforms .IOS , Platforms .MAC , Platforms .LINUX , Platforms . WP8 , Platforms . WP8_1 , Platforms . METRO ]
254
266
255
267
# filter the available platform list
256
268
platform_list = self ._filter_platforms (platform_list )
@@ -303,6 +315,15 @@ def is_win32_active(self):
303
315
def is_linux_active (self ):
304
316
return self ._current == Platforms .LINUX
305
317
318
+ def is_wp8_active (self ):
319
+ return self ._current == Platforms .WP8
320
+
321
+ def is_wp8_1_active (self ):
322
+ return self ._current == Platforms .WP8_1
323
+
324
+ def is_metro_active (self ):
325
+ return self ._current == Platforms .METRO
326
+
306
327
def get_current_config (self ):
307
328
if self .none_active ():
308
329
return None
@@ -534,3 +555,99 @@ def _is_available(self):
534
555
ret = super (WebConfig , self )._is_available ()
535
556
536
557
return ret
558
+
559
+ class Wp8Config (PlatformConfig ):
560
+ KEY_BUILD_FOLDER_PATH = "build_folder_path"
561
+ KEY_MANIFEST_PATH = "manifest_path"
562
+
563
+ def _use_default (self ):
564
+ if self ._is_script :
565
+ self .proj_path = os .path .join (self ._proj_root_path , "frameworks" , "runtime-src" , "proj.wp8-xaml" )
566
+ else :
567
+ self .proj_path = os .path .join (self ._proj_root_path , "proj.wp8-xaml" )
568
+
569
+ self .sln_file = None
570
+ self .project_name = None
571
+ self .build_folder_path = "App/Bin/x86"
572
+ self .manifest_path = "App/Properties/WMAppManifest.xml"
573
+
574
+ def _parse_info (self , cfg_info ):
575
+ super (Wp8Config , self )._parse_info (cfg_info )
576
+ if cfg_info .has_key (Win32Config .KEY_SLN_FILE ):
577
+ self .sln_file = cfg_info [Win32Config .KEY_SLN_FILE ]
578
+ else :
579
+ self .sln_file = None
580
+
581
+ if cfg_info .has_key (Win32Config .KEY_PROJECT_NAME ):
582
+ self .project_name = cfg_info [Win32Config .KEY_PROJECT_NAME ]
583
+ else :
584
+ self .project_name = None
585
+
586
+ if cfg_info .has_key (Wp8Config .KEY_BUILD_FOLDER_PATH ):
587
+ self .build_folder_path = cfg_info [Wp8Config .KEY_BUILD_FOLDER_PATH ]
588
+ else :
589
+ self .build_folder_path = "App/Bin/x86"
590
+
591
+ if cfg_info .has_key (Wp8Config .KEY_MANIFEST_PATH ):
592
+ self .manifest_path = cfg_info [Wp8Config .KEY_MANIFEST_PATH ]
593
+ else :
594
+ self .manifest_path = "App/Properties/WMAppManifest.xml"
595
+
596
+ def _is_available (self ):
597
+ ret = super (Wp8Config , self )._is_available ()
598
+
599
+ return ret
600
+
601
+ class Wp8_1Config (PlatformConfig ):
602
+ def _use_default (self ):
603
+ if self ._is_script :
604
+ self .proj_path = os .path .join (self ._proj_root_path , "frameworks" , "runtime-src" , "proj.win8.1-universal" )
605
+ else :
606
+ self .proj_path = os .path .join (self ._proj_root_path , "proj.win8.1-universal" )
607
+
608
+ self .sln_file = None
609
+ self .project_name = None
610
+
611
+ def _parse_info (self , cfg_info ):
612
+ super (Wp8_1Config , self )._parse_info (cfg_info )
613
+ if cfg_info .has_key (Win32Config .KEY_SLN_FILE ):
614
+ self .sln_file = cfg_info [Win32Config .KEY_SLN_FILE ]
615
+ else :
616
+ self .sln_file = None
617
+
618
+ if cfg_info .has_key (Win32Config .KEY_PROJECT_NAME ):
619
+ self .project_name = cfg_info [Win32Config .KEY_PROJECT_NAME ]
620
+ else :
621
+ self .project_name = None
622
+
623
+ def _is_available (self ):
624
+ ret = super (Wp8_1Config , self )._is_available ()
625
+
626
+ return ret
627
+
628
+ class MetroConfig (PlatformConfig ):
629
+ def _use_default (self ):
630
+ if self ._is_script :
631
+ self .proj_path = os .path .join (self ._proj_root_path , "frameworks" , "runtime-src" , "proj.win8.1-universal" )
632
+ else :
633
+ self .proj_path = os .path .join (self ._proj_root_path , "proj.win8.1-universal" )
634
+
635
+ self .sln_file = None
636
+ self .project_name = None
637
+
638
+ def _parse_info (self , cfg_info ):
639
+ super (MetroConfig , self )._parse_info (cfg_info )
640
+ if cfg_info .has_key (Win32Config .KEY_SLN_FILE ):
641
+ self .sln_file = cfg_info [Win32Config .KEY_SLN_FILE ]
642
+ else :
643
+ self .sln_file = None
644
+
645
+ if cfg_info .has_key (Win32Config .KEY_PROJECT_NAME ):
646
+ self .project_name = cfg_info [Win32Config .KEY_PROJECT_NAME ]
647
+ else :
648
+ self .project_name = None
649
+
650
+ def _is_available (self ):
651
+ ret = super (MetroConfig , self )._is_available ()
652
+
653
+ return ret
0 commit comments