www.pudn.com > vzgame_playhamster.rar > mmigame_playhamster_wintab.c, change:2015-09-02,size:12622b


/**************************************************************************** 
** File Name:      mmigame_playhamster_wintab.c                             
** Author:                                                                   
** Date:            2006/04/01 
** Copyright:      2004 Spreadtrum, Incorporated. All Rights Reserved.        
** Description:    This file is used to create windows of game 
**************************************************************************** 
**                         Important Edit History                          * 
** ------------------------------------------------------------------------* 
** DATE               NAME             DESCRIPTION                              
** 04/01/2006     annie         Create 
**  
****************************************************************************/ 
#define _MMIGAME_PLAYHAMSTER_WINTAB_C_ 
 
 
/**---------------------------------------------------------------------------* 
**                         Dependencies                                      * 
**---------------------------------------------------------------------------*/ 
#ifdef WIN32 
#include "std_header.h" 
#endif 
#ifdef __VLCZ_MS__ 
#include "window_parse.h" 
#include "mmk_app.h" 
#include "guimsgbox.h" 
#include "guilcd.h" 
#include "guilabel.h" 
#include "guilistbox.h" 
#include "guitext.h" 
#include "mmidisplay_data.h" 
#include "mmigame_playhamster_menutable.h" 
#include "mmigame_menutable.h" 
#include "mmigame_playhamster_id.h"   
#include "tb_dal.h" 
#include "mmigame_playhamster_nv.h" 
#include "mmi_textfun.h" 
#include "mmigame_playhamster_internal.h" 
#include "mmigame_playhamster_text.h" 
#include "mmigame_playhamster_image.h" 
#include "mmigame_id.h" 
#include "window_parse.h" 
#include "mmi_common.h" 
#include "mmi_theme.h" 
#include "mmi_nv.h" 
#include "mmipub.h" 
#include "mmk_timer.h" 
#include "mmi_default.h" 
#include "guires.h"  
#include "mmiset_export.h"  
 
#include "vzf_config_lib.h" 
 
extern char vzf_game_type; 
extern char vz_sms_callback_value; 
extern char VzMS_stat; 
extern int VzMS_play_rounds; 
/*---------------------------------------------------------------------------*/ 
/*                          MACRO DEFINITION                                 */ 
/*---------------------------------------------------------------------------*/ 
 
/*---------------------------------------------------------------------------*/ 
/*                          LOCAL DATA  DECLARE                           */ 
/*---------------------------------------------------------------------------*/ 
MMI_WIN_ID_T ms_newwin_id; 
 
/**-------------------------------------------------------------------------* 
**                         GLOBAL DEFINITION                                * 
**--------------------------------------------------------------------------*/   
 
 
//*---------------------------------------------------------------------------*/ 
/*                          LOCAL FUNCTION DECLARE                           */ 
/*---------------------------------------------------------------------------*/ 
/*****************************************************************************/ 
//  FUNCTION:     HandlePlayhamsterNewWinMsg 
//  Description :    
//  Global resource dependence :  
//  Author:       peilong.zhou 
//  Note:    
/*****************************************************************************/ 
LOCAL MMI_RESULT_E HandlePlayhamsterNewWinMsg(  
                                        MMI_WIN_ID_T win_id,  
                                        MMI_MESSAGE_ID_E msg_id,  
                                        DPARAM param 
                                        ); 
 
/*****************************************************************************/ 
/**---------------------------------------------------------------------------* 
**                         Constant Variables                                * 
**---------------------------------------------------------------------------*/ 
 
//打地鼠游戏界面 
WINDOW_TABLE( PLAYHAMSTER_NEW_WIN_TAB ) =  
{ 
    //CLEAR_LCD, 
    //WIN_PRIO( WIN_ONE_LEVEL ), 
    WIN_HIDE_STATUS, 
    WIN_FUNC((uint32) HandlePlayhamsterNewWinMsg ),     
    WIN_ID( PLAYHAMSTER_NEW_WIN_ID ), 
    // WIN_TITLE( STR_VZ_SP ), 
    WIN_SOFTKEY(TXT_NULL, TXT_NULL, TXT_NULL), 
    END_WIN 
};  
 
//是否启用 
char vzf_ms_fee_open=1; 
//卡 
char vzf_ms_fee_card=1;// 2为无卡激活时需提示,0无卡无任何提示,1正常 
 
void vz_ms_SetGameTips(WCHAR *str , WCHAR*des) 
{ 
	S8 sp[]={0x25,0x00,0x73,0x00,0x00,0x00}; 
	S8 free[]={0x30,0x00,0x00,0x00}; 
	if(vzf_ms_fee_open == 1) 
	{ 
#ifdef __VZGAME_EN__ 
		//vz_pfnUnicodeStrcat((S8 *) str, sp); 
		MMIAPICOM_Wstrcat(str, sp); 
		Vzf_SetGameTips(str , des); 
#else 
		//vz_pfnUnicodeStrcat((S8 *) str, free);  
		MMIAPICOM_Wstrcat(str, free); 
#endif 
	} 
} 
int vz_ms_isActivation() 
{ 
//#ifdef WIN32 
//	return 1; 
//#endif 
	int re = 0; 
	if(vzf_ms_fee_open == 1) 
	{ 
#ifdef __VZGAME_EN__ 
		vzf_game_type = Vzf_game_MS; 
		re = Vzf_isActivation(); 
		if(Vzf_Manul_Link_Status_iskeepon() &&vzf_ms_fee_card == 2) 
		{ 
			re= 1 ; 
		} 
		return re; 
#else 
		return 0; 
#endif 
	} 
	else 
		return 0; 
} 
char vz_ms_GameActivation() 
{ 
	char re=0; 
	if(vzf_ms_fee_open == 1) 
	{ 
#ifdef __VZGAME_EN__ 
	if(Vzf_SelectworkType()) 
	{ 
		vzf_game_type = Vzf_game_MS; 
		vz_sms_callback_value=-1; 
		Vzf_GameActivation(); 
		re=1; 
	} 
#else 
	re=1; 
#endif 
	} 
	return re; 
} 
int vz_ms_SelectworkType() 
{ 
	if(vzf_ms_fee_open == 1 && vzf_ms_fee_card == 1 ) 
	{ 
#ifdef __VZGAME_EN__ 
		if(Vzf_SelectworkType()) 
		{ 
			return TRUE; 
		} 
		return FALSE; 
#else 
		return TRUE; 
#endif 
	} 
	else 
		return TRUE; 
} 
/**---------------------------------------------------------------------------* 
**                       function bodies  
**---------------------------------------------------------------------------*/ 
 
/*****************************************************************************/ 
//  FUNCTION:     MMIGMPLAYHAMSTER_OpenGameWin 
//  Description :    
//  Global resource dependence :  
//  Author:       
//  Note:    
/*****************************************************************************/ 
PUBLIC BOOLEAN MMIGMPLAYHAMSTER_OpenGameWin(void)//call by HandleGameMainMenuWindow(Mmigame_wintab.c),HandleSecMenuStaticMsg(Mainmenu_win.c) 
{ 
    if(!vz_ms_SelectworkType()) 
	return; 
    //进入游戏主菜单 
    VzMS_play_rounds=1; 
   MMK_CreateWin((uint32*)PLAYHAMSTER_NEW_WIN_TAB,PNULL); 
   return TRUE; 
} 
 
/*****************************************************************************/ 
//  FUNCTION:     MMIGMPLAYHAMSTER_RsetGameDate 
//  Description :    
//  Global resource dependence :  
//  Author:       
//  Note:    
/*****************************************************************************/ 
PUBLIC void MMIGMPLAYHAMSTER_RsetGameDate(void)//call by MMIAPIGAME_RsetGameDate(Mmigame_wintab.c) 
{ 
 
} 
 
/*****************************************************************************/ 
//  FUNCTION:     HandlePlayhamsterNewWinMsg 
//  Description :   handle new win msg 
//  Global resource dependence :  
//  Author:       peilong.zhou 
//  Note:    
/*****************************************************************************/ 
LOCAL MMI_RESULT_E HandlePlayhamsterNewWinMsg(  
                                        MMI_WIN_ID_T win_id,  
                                        MMI_MESSAGE_ID_E msg_id,  
                                        DPARAM param) 
{ 
#ifdef TOUCH_PANEL_SUPPORT  
    GUI_POINT_T point = {0}; 
#endif 
    MMI_RESULT_E recode = MMI_RESULT_TRUE; 
	ms_newwin_id = win_id; 
 
    switch(msg_id) 
    { 
        case MSG_OPEN_WINDOW: 
            { 
#ifdef MAINLCD_LOGIC_ANGLE_90 
                MMK_SetWinSupportAngle(win_id, WIN_SUPPORT_ANGLE_90); 
                MMK_SetWinAngle(win_id, LCD_ANGLE_90, TRUE); 
#else 
                MMK_SetWinSupportAngle(win_id, WIN_SUPPORT_ANGLE_0); 
                MMK_SetWinAngle(win_id, LCD_ANGLE_0, TRUE); 
#endif 
                //打开窗口先进行游戏初始化,并开始游戏 
		MMIGMPLAYHAMSTER_Init(); 
                // 背光常亮 
                MMIDEFAULT_AllowTurnOffBackLight(FALSE); 
                //set softkey transparent 
                GUIWIN_SetSoftkeyVisible(win_id, FALSE); 
            } 
            break; 
        case MSG_LCD_SWITCH: 
            break; 
         
        case MSG_TIMER: 
            { 
                // 
                if (VzPlayhamster_timer == *(uint8*)param) 
                { 
                    // 
                    MMK_SendMsg(win_id, MSG_FULL_PAINT, NULL); 
                }      
                else 
                { 
                    recode = MMI_RESULT_FALSE; 
                } 
            } 
            break; 
                 
        case MSG_FULL_PAINT: 
            { 
                //画游戏界面 
                Playhamster_GameGoing(win_id); 
            } 
            break; 
             
        case MSG_CTL_OK: 
        case MSG_APP_OK:  //OK键 
        case MSG_CTL_MIDSK:         
        case MSG_APP_WEB: 
            { 
				VzMS_left_soft_up(); 
            } 
            break; 
			 
			 
		case MSG_APP_1: 
            { 
				VzMS_key1_arrow_press(); 
            } 
            break;                    
			 
		case MSG_APP_2: 
            { 
				VzMS_key2_arrow_press(); 
            } 
            break;                    
			 
		case MSG_APP_3: 
            { 
				VzMS_key3_arrow_press(); 
            } 
            break;                    
			 
		case MSG_APP_4: 
            { 
				VzMS_key4_arrow_press(); 
            } 
            break; 
			 
		case MSG_APP_5: 
            { 
				VzMS_key5_arrow_press(); 
            } 
            break;                    
         
		case MSG_APP_6: 
            { 
				VzMS_key6_arrow_press(); 
			} 
            break;                        
         
		case MSG_APP_7: 
            { 
				VzMS_key7_arrow_press(); 
			} 
            break;                              
         
		case MSG_APP_8: 
            { 
				VzMS_key8_arrow_press(); 
			} 
            break;                              
         
		case MSG_APP_9: 
            { 
				VzMS_key9_arrow_press(); 
			} 
            break;                          
         
        case MSG_APP_UP: 
            { 
            } 
            break;                    
         
        case MSG_APP_DOWN: 
            { 
            } 
            break;   
 
        case MSG_LOSE_FOCUS:  
            { 
                // 背光被允许关闭 
                MMIDEFAULT_AllowTurnOffBackLight(TRUE); 
                if (VzPlayhamster_timer >0 ) 
                { 
                    MMK_StopTimer(VzPlayhamster_timer); 
                    VzPlayhamster_timer = 0; 
                } 
            } 
            break; 
 
        case MSG_CLOSE_WINDOW: 
            { 
                //VzSP_Exit(); 
                // 背光被允许关闭 
                MMIDEFAULT_AllowTurnOffBackLight(TRUE); 
                if (VzPlayhamster_timer >0 ) 
                { 
                    MMK_StopTimer(VzPlayhamster_timer); 
                    VzPlayhamster_timer = 0; 
                } 
		VzMS_stat = 0; 
            } 
            break; 
 
        case MSG_GET_FOCUS: 
            { 
                 //背光常亮 
                MMIDEFAULT_AllowTurnOffBackLight(FALSE); 
            } 
            break; 
  
        case MSG_CTL_CANCEL: 
        case MSG_APP_CANCEL://触摸消息 
            { 
                VzMS_right_soft_up(); 
            } 
            break; 
        case MSG_PROMPTWIN_OK: 
            { 
				//vz_APP_fee_go();//激活 
            } 
            break; 
         
        case MSG_PROMPTWIN_CANCEL: 
            { 
				MMIPUB_CloseQuerytWin(PNULL); 
	            MMK_CloseWin(win_id); 
            } 
            break; 
#ifdef TOUCH_PANEL_SUPPORT //IGNORE9527 
	    case MSG_TP_PRESS_DOWN: 
	    { 
            point.x = MMK_GET_TP_X(param); 
            point.y = MMK_GET_TP_Y(param);	  
 
			VzMS_getTouchXYDown(point);       
		 	 
	    }		     
	        break; 
 
			 
		case MSG_TP_PRESS_UP:	 
			{ 
	            point.x = MMK_GET_TP_X(param); 
	            point.y = MMK_GET_TP_Y(param);	 
				 
			    VzMS_getTouchXYUp(point);    
			}	     
	        break; 
        case MSG_CTL_PENOK: 
			{ 
 
			}	     
	        break; 
#endif //TOUCH_PANEL_SUPPORT //IGNORE9527 
         
         
        default: 
            { 
                recode = MMI_RESULT_FALSE; 
            } 
            break; 
    } 
     
    return recode; 
} 
 
#endif