| 1 |
/*======================================================================*//** |
|---|
| 2 |
* com.emzah.utils.Seiza Class for ActionScript 2.0 |
|---|
| 3 |
* |
|---|
| 4 |
* @author Copyright (c) 2007 gen:emzah.com |
|---|
| 5 |
* @version 0.1 |
|---|
| 6 |
* |
|---|
| 7 |
* @link http://emzah.com |
|---|
| 8 |
* @link http://blog.emzah.com |
|---|
| 9 |
* |
|---|
| 10 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
|---|
| 11 |
* you may not use this file except in compliance with the License. |
|---|
| 12 |
* You may obtain a copy of the License at |
|---|
| 13 |
* |
|---|
| 14 |
* http://www.apache.org/licenses/LICENSE-2.0 |
|---|
| 15 |
* |
|---|
| 16 |
* Unless required by applicable law or agreed to in writing, software |
|---|
| 17 |
* distributed under the License is distributed on an "AS IS" BASIS, |
|---|
| 18 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, |
|---|
| 19 |
* either express or implied. See the License for the specific language |
|---|
| 20 |
* governing permissions and limitations under the License. |
|---|
| 21 |
*//*=======================================================================*/ |
|---|
| 22 |
|
|---|
| 23 |
/** |
|---|
| 24 |
* Seizaは星座を取得するためのクラスです |
|---|
| 25 |
* @data 2007/05/21 |
|---|
| 26 |
* @usage |
|---|
| 27 |
* <code> |
|---|
| 28 |
* Seiza(1,1,1);//山羊座 |
|---|
| 29 |
* </code> |
|---|
| 30 |
* ////////////////////////////////////////// |
|---|
| 31 |
* 正確には誕生年も関係します。 |
|---|
| 32 |
* 実際に使用する場合には調べてからお使いください。 |
|---|
| 33 |
* http://ja.wikipedia.org/wiki/十二宮 |
|---|
| 34 |
* http://ja.wikipedia.org/wiki/星座占い |
|---|
| 35 |
* ////////////////////////////////////////// |
|---|
| 36 |
*/ |
|---|
| 37 |
|
|---|
| 38 |
class com.emzah.utils.Seiza { |
|---|
| 39 |
|
|---|
| 40 |
private var birthday_month:Number; |
|---|
| 41 |
private var birthday_date:Number; |
|---|
| 42 |
private var type:Number; |
|---|
| 43 |
|
|---|
| 44 |
public var seiza:String = null; |
|---|
| 45 |
private var seizaArrray:Array = new Array( |
|---|
| 46 |
"牡羊座","牡牛座","双子座","蟹座", |
|---|
| 47 |
"獅子座","乙女座","天秤座","蠍座", |
|---|
| 48 |
"射手座","山羊座","水瓶座","魚座"); |
|---|
| 49 |
|
|---|
| 50 |
function Seiza(birthday_month,birthday_date,type) { |
|---|
| 51 |
//数字で変えします |
|---|
| 52 |
if (type == 0) { |
|---|
| 53 |
seiza = String(setSeizaNum(birthday_month,birthday_date)); |
|---|
| 54 |
//文字列で変えします |
|---|
| 55 |
} else if (type == 1) { |
|---|
| 56 |
seiza = setSeizaStr(setSeizaNum(birthday_month,birthday_date)); |
|---|
| 57 |
} else { |
|---|
| 58 |
Error(); |
|---|
| 59 |
} |
|---|
| 60 |
} |
|---|
| 61 |
|
|---|
| 62 |
private function setSeizaStr(s:Number):String { |
|---|
| 63 |
return seizaArrray[s]; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
private function setSeizaNum(birthday_month:Number,birthday_date:Number):Number { |
|---|
| 67 |
|
|---|
| 68 |
if ((birthday_month == 3 && birthday_date >= 21) || (birthday_month == 4 && birthday_date <= 19 )) { |
|---|
| 69 |
return 0;//"牡羊座"; |
|---|
| 70 |
} else if ((birthday_month == 4 && birthday_date >= 20) || (birthday_month == 5 && birthday_date <= 20 )) { |
|---|
| 71 |
return 1;//"牡牛座"; |
|---|
| 72 |
} else if ((birthday_month == 5 && birthday_date >= 21) || (birthday_month == 6 && birthday_date <= 21 )) { |
|---|
| 73 |
return 2;//"双子座"; |
|---|
| 74 |
} else if ((birthday_month == 6 && birthday_date >= 22) || (birthday_month == 7 && birthday_date <= 22 )) { |
|---|
| 75 |
return 3;//"蟹座"; |
|---|
| 76 |
} else if ((birthday_month == 7 && birthday_date >= 23) || (birthday_month == 8 && birthday_date <= 22 )) { |
|---|
| 77 |
return 4;//"獅子座"; |
|---|
| 78 |
} else if ((birthday_month == 8 && birthday_date >= 23) || (birthday_month == 9 && birthday_date <= 22 )) { |
|---|
| 79 |
return 5;//"乙女座"; |
|---|
| 80 |
} else if ((birthday_month == 9 && birthday_date >= 23) || (birthday_month == 10 && birthday_date <= 23 )) { |
|---|
| 81 |
return 6;//"天秤座"; |
|---|
| 82 |
} else if ((birthday_month == 10 && birthday_date >= 24) || (birthday_month == 11 && birthday_date <= 21 )) { |
|---|
| 83 |
return 7;//"蠍座"; |
|---|
| 84 |
} else if ((birthday_month == 11 && birthday_date >= 22) || (birthday_month == 12 && birthday_date <= 21 )) { |
|---|
| 85 |
return 8;//"射手座"; |
|---|
| 86 |
} else if ((birthday_month == 12 && birthday_date >= 22) || (birthday_month == 1 && birthday_date <= 19 )) { |
|---|
| 87 |
return 9;//"山羊座"; |
|---|
| 88 |
} else if ((birthday_month == 1 && birthday_date >= 20) || (birthday_month == 2 && birthday_date <= 18 )) { |
|---|
| 89 |
return 10;//"水瓶座"; |
|---|
| 90 |
} else if ((birthday_month == 2 && birthday_date >= 19) || (birthday_month == 3 && birthday_date <= 20 )) { |
|---|
| 91 |
return 11;//"魚座"; |
|---|
| 92 |
} else { |
|---|
| 93 |
return undefined; |
|---|
| 94 |
} |
|---|
| 95 |
} |
|---|
| 96 |
} |
|---|